Showing a Message Dialog or Confirmation Prompt in a Creatio Freedom UI Page

Showing Message Dialogs and Confirmation Prompts from a Freedom UI page work by executing a request to show a dialog. You can pass an array of buttons plus a message. This asynchronous request will provide you with the result selected by the user. The request to execute is a crt.ShowDialogRequest. The end result is a flexible message dialog.

To display a message, you’d simply execute a crt.ShowDialogRequest as follows:

request.$context.executeRequest({
	type: "crt.ShowDialogRequest",
	$context: request.$context,
	dialogConfig: {
		data: {
			message: "You did a thing.",
			actions: [{
				key: "OK",
				config: {
					color: "primary",
					caption: "OK
				}
			}]
		}
	}
});

If you want to display a confirmation prompt, you’d do just the same, except you’d define more buttons. In this example, we’ll define the prompt that displays in this article with two different choices:

const okBtn = {
	key: "OK",
	config: {
		color: "primary",
		caption: "Do it"
	}
};
const cancelBtn = {
	key: "CANCEL",
	config: {
		color: "default",
		caption: "Cancel"
	}
};

const result = await request.$context.executeRequest({
	type: "crt.ShowDialogRequest",
	$context: request.$context,
	dialogConfig: {
		data: {
			message: "Do you want to do the thing?",
			actions: [cancelBtn, okBtn]
		}
	}
});

if (result === "OK") {
	// ok was clicked
}

Note, we can await the result to get the button (key) that the user clicked. As for the buttons, you can include a key (the tag for the button), a caption, and a color. The color choices available you can include are as follows:

  • “default” = white, no color
  • “primary” = blue
  • “accent” = green
  • “warn” = red

Want content like this delivered to your inbox? Sign up for our newsletter!
ABOUT THE AUTHOR

Ryan Farley

Ryan Farley is the Director of Development for Customer FX and creator of slxdeveloper.com. He's been blogging regularly about SalesLogix, now Infor CRM, since 2001 and believes in sharing with the community. His new passion for CRM is Creatio, formerly bpm'online. He loves C#, Javascript, web development, open source, and Linux. He also loves his hobby as an amateur filmmaker.

2 Comments

  1. Hi Ryan

    Is there an update in this article?, in Creatio 8.1 it didn’t works.

    I understand the way the handlers code works it could be changed from the article date to current Creatio version

    Thanks

    Reply
    • Hi Julio,
      There have been some changes in the requests in recent versions, however, the code in this article does work in current versions. I have code similar to this and all working as expected.
      Ryan

Submit a Comment

Your email address will not be published. Required fields are marked *