Alert Dialog and Confirm Dialog in MSCRM 2013 Using Javascript


Arun Potti's MS CRM blog

Especially Alert and Confirm Dialog designed for Mobiles/Tablets replacing window.alert and window.confirm.

It’s a best practice to use the new Syntax for Online/On premise as well.

Alert Dialog: Displays a dialog box like alert.

Syntax: Xrm.Utility.alertDialog(message,onCloseCallback)

Parameter NameTypeDescription
messageStringThe text of the message to display in the dialog.
onCloseCallbackFunctionA function to execute when the OK button or Close button clicked.Use null if you don’t want callback.

Example: Set Personal Notes field with some text in Contact Entity Onload after Alert Click on Ok or Cancel/Close

Solution: Copy and paste the below Code in Contact Entity and call showAlertDialog on onLoad

function showAlertDialog() {
Xrm.Utility.alertDialog(“Click Ok or Cancel to set the Personal Notes Value”, function() {
Xrm.Page.getAttribute(“description”).setValue(“alertDialog Fired”);
});
}

Output:

showAlertDialogAfter Click on Ok or Cancel,

showAlertDialog Fired

Confirm Dialog: Displays a confirmation dialog box that contains…

View original post 147 more words