top of page
pedroairo9

CRM 2015 – Javascript – Display Notifications




Below a table with the ways to display notifications using the CRM objects.

Task

Example

Display a message near the control to indicate that data is not valid.

Xrm.Page.getAttribute("name").controls.forEach( function (control, i) { control.setNotification("’Test’ is not a valid name."); })

Sets a validation error message on every control in the form for the Account Nameattribute.

While this message is displayed the record cannot be saved.

This method is only available for Updated entities.

Remove a message already displayed for a control.

Xrm.Page.getAttribute("name").controls.forEach( function (control, i) { control.clearNotification(); })

Clears all validation error messages on every control in the form for the Account Nameattribute.

This method is only available for Updated entities.

Display form level notifications.

Xrm.Page.ui.setFormNotification( "Hello", "INFO", "helloMsg" );

Displays the message “Hello” at the top of the form with a system info icon.

This method is only available for Updated entities.

Remove form level notifications

Xrm.Page.ui.clearFormNotification("helloMsg");

Clears the message previously set using “helloMsg” as the uniqueid parameter.

This method is only available for Updated entities.

Display a non-blocking alert dialog with a callback function.

var alertDisplayed = false; Xrm.Utility.alertDialog( "Showing Alert", function () { alertDisplayed = true; } )

Display an alert and set the value of the alertDisplayed variable when it is closed.

This method is only available for Updated entities.

Display a non-blocking confirm dialog with different callbacks depending on the button clicked by the user.

var agree = false; Xrm.Utility.confirmDialog( "Do you agree?", function () { agree = true;}, function () { agree = false; } );

Display a confirmation message and set the value of the agree variable depending on the response.

This method is only available for Updated entities.

3 views0 comments

Recent Posts

See All

Comments


bottom of page