Form notifications
Banners at the top of a form for information, warnings and errors, raised from form scripts with the Client API.
What it is
A form notification is a banner at the top of the form with an info, warning or error icon and a message. A form script raises it with formContext.ui.setFormNotification(message, level, uniqueId), where level is INFO, WARNING or ERROR. A field notification is a related but separate message that sits next to one column, set with setNotification.
When to use it
Use a form notification for a message about the whole record, such as a missing document or a pending review. Use a field notification or a business rule's Show Error Message for a problem with one column. For a message that every app user must see, Xrm.App.addGlobalNotification shows a bar across the app instead.
Licensing and configuration
No extra licence. It needs a JavaScript web resource added to the form's Events in the form designer, usually on OnLoad or OnChange. Remove a banner with clearFormNotification and the same unique id.
Pitfalls
- Every notification needs a unique id. Without it you cannot remove the message later.
- The notification area has limited height. New messages appear on top and older ones need scrolling.
- Form notifications do not block saving. A field error set with
setNotificationdoes. - A field notification on a control inside a hidden tab or section blocks the save and the user cannot fix it.
Try it in the demo
- Open the Form notifications section on the first accelerator.
- Select Show info, Show warning and Show error and read the banners at the top.
- Select Clear to remove all three.