, , , , , ,

Hello Everyone,

Setting up the {Info, Warning, Error] notifications on the forms is a generic requirement for most of the time which are based on multiple scenarios (eg. on case page load to notify the agent any particular details about the customer). I use the below jScript again and again in my deployment so pinning it down below. The detailed are there in the MS article and docs.



Xrm.Page.ui.setFormNotification(message, level, uniqueId);

Where the 3 parameters are

TypeString. The text of the message.

TypeString. The level of the message.

The level defines how the message will be displayed.

  • ERROR : Notification will use the system error icon.
  • WARNING : Notification will use the system warning icon.
  • INFO : Notification will use the system info icon.
TypeString. A unique identifier for the message used with clearFormNotification to remove the notification.



The Next script would be to clear those notification based on the uniqueId assigned to the notification above.




And now the best part; flashing the formNotifications only for a couple of seconds and clear them automatically. This can be done via Timeout function:

setTimeout( function () { Xrm.Page.ui.clearFormNotification(id); }, time );


My overall sample code below:

var message = “The Contract is about to expiry, kindly consult customer to renew.”;
var id = “101”;  //Notification Id
var time = 5000;  //Display time in milliseconds

//Display the notification
Xrm.Page.ui.setFormNotification(message, type, id);

//Wait the designated time and then remove the notification
setTimeout( function () {Xrm.Page.ui.clearFormNotification(id);}, time );


I would keep this as a sticky note, thanks to Jason Lattimer for his blog post; it still works on the D365 forms.