top of page

CRM 2015 – Javascript – Alert vs Form Notification




For many years i used the old Alert to show error or warning messages in CRM, i was using that from a web resource or form. But Microsoft provides a way of doing that in terms of CRM point of view.

So, inside of a form and for custom validations now we can use the following:


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. What’s the problem in here, i was tying to use this inside of a Web Resource that even is not inside of a CRM Form and debugging i discovered that Xrm.Page.ui is ‘undefined’, so after research i came across with the below way to 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. The result is our old Alert:


Probably i will do my own custom dialog. Any ideas?

3 views0 comments

Recent Posts

See All

CRM 365 - Customer field only show Accounts

On a customer field, if the requirement is to only show Accounts, please add this line to the OnLoad of the form: //Show only Account records when selecting the Customer formContext.getControl("cu

Execute Workflow Request on CRM 365 Cloud

Please find below an example of calling the Execute method to run a workflow on CRM 365 Cloud. let Id = formContext.data.entity.getId().replace('{', '').replace('}', ''); let request =

Comments


bottom of page