Displaying Information, Confirmation, and Error Dialogs in bpm’online

If you need to interact with the user from your form code in bpm’online, to display information, prompt for a choice, or show an error, there are several built-in dialog options you can use.

Displaying Information

This is a simple dialog, used to provide some message to the user. The code to display this is as follows:

Terrasoft.showInformation("Welcome to the information message dialog");

If for some reason you need to know when the user clicks OK to dismiss the dialog, you can provide a callback function and context parameter as well:

Terrasoft.showInformation("Welcome to the information message dialog", function(result) { 
    this.console.log(result); // result will be "ok"
}, this);

 

Displaying Errors

When something has gone wrong, you can use an error dialog, rather than the information dialog. This makes it clear that something unexpected or incorrect has happened, indicated by the red color of the dialog.

Terrasoft.showErrorMessage("An error has occurred doing something");

Note, this also can optionally take a callback, and context parameter so you’ll know when the user clicked the OK button to close the dialog.

Terrasoft.showErrorMessage("An error has occurred doing something", function(result) {
    // user closed the dialog
    this.console.log(result); // result will be "ok"
}, this);

 

Prompting for Choices

If you’d like to prompt the user for a choice, you can use the confirmation dialog. This has a callback for when the user makes a choice and clicks one of the options. The parameter for the callback will provide the text of the button clicked.

Terrasoft.showConfirmation("Would you like to do the thing?", function(result) { 
    this.console.log("The user selected " + result); // result will be "yes" or "no" 

    or we could use the constants, like this:
    if (result === Terrasoft.MessageBoxButtons.YES.returnCode) {
        // do something
    }
}, ["yes", "no"], this);

Note, you can also define custom buttons, however, you can’t just provide a string for the caption, you need to provide the config for the button itself, like this:

Terrasoft.showConfirmation("Would you like to do the thing?", function(result) { console.log(result); }, ["yes", "no", {
 	className: "Terrasoft.Button",
 	returnCode: "somethingElse",
 	style: "green",
 	caption: "Something else"
  }], this);

This will produce the following dialog:

We specified “somethingElse” for our return code for that button, so that is what we’ll be passed if the user clicks that option.

 

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. He loves C#, Javascript, web development, open source, and Linux. He also loves his hobby as an amateur filmmaker.

Submit a Comment

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

Subscribe To Our Newsletter

Join our mailing list to receive the latest Infor CRM (Saleslogix) news and product updates!

You have Successfully Subscribed!