Having the ability to display notifications to the end-user has always been one of the top requests from our clients. In Microsoft Dynamics CRM 2011, it was possible but required using unsupported methods in the client API.
With the release of CRM 2013, the ability to display notifications is now a supported feature of the SDK. Notifications can be displayed on either the Form level or on a Field level.
There are only two functions related to form notifications:
Below is an example of setting a notification on the form:
Xrm.Page.ui.setFormNotification("This is a form notification!", "INFO", "uniqueIdForNotification");
The first argument to this method is the actual message that you wish to display. The second argument specifies the type of notification. The valid values for this type are ERROR, WARNING and INFO. The final argument is a unique identifier for this particular notification.
To clear this notification, we just need to pass in our unique identifier to the clearFormNotification.
Field level notifications behave in a similar manner. As with the form level notifications, there are only two functions:
These functions need to be called on a particular attribute on the form:
Xrm.Page.getControl("new_myAttribute").setNotification("This is my field based notification message!"); Xrm.Page.getControl("new_myAttribute").clearNotification();
There is no need to specify a unique identifier for these notifications as they are associated with the attributes on the form.
Finally, there seems to be a limitation where only four form level notifications can be displayed at one time, with any more resulting in an error. Keep this in mind when generating notifcations for your end users!
For more information about Microsoft CRM, click here.