How To Show Form Level Notification On Any Microsoft Dynamics CRM Page
Previously, we had explained how to show Field level error message on Form using Business Rule in CRM. So, today we will explain how to show Form level notification using java script on any CRM page.
There are three types of form level messages available.
- Error notification
- Warning notification
- Information notification
The method is used to display these three notification is same as below.
“setFormNotification”
Now, I created a web resource in CRM with following function, and set the call of this function on form save event of CRM page.
function SaveForm()
{
var today = new Date();
Xrm.Page.ui.setFormNotification('Error! Birth Date is required', 'ERROR');
Xrm.Page.ui.setFormNotification('Warning! Birth Date is greater than Parent’s Marriage date', 'WARNING');
Xrm.Page.ui.setFormNotification('Information: Form will save after valid data', 'INFORMATION');
}
This will display messages on form as below.

To overwrite this default functionality, we can set unique ID to each notification and overwrite so now user will show only three messages on screen same as below.
function SaveForm()
{
var today = new Date();
Xrm.Page.ui.setFormNotification('Error! Birth Date is required', 'ERROR', '1');
Xrm.Page.ui.setFormNotification('Warning! Birth Date is greater than Parent’s Marriage date', 'WARNING', '2');
Xrm.Page.ui.setFormNotification('Information: Form will save after valid data', 'INFORMATION', '3');
}
We can clear all using clearFormNotification() or individual notifications using clearFormNotification() with unique notification ID.
Xrm.Page.ui.clearFormNotification();
Xrm.Page.ui.clearFormNotification('1');
After reading above example, we hope you will be now able to show form level notification on any Microsoft dynamics CRM page using java script. You can share your experience with us. For general queries related to CRM development, please connect with our professionals. You can simply comment in below section and our experts in Microsoft dynamics CRM developers will reply soon.