FormsModel-driven app

Form notifications

Banners at the top of a form for information, warnings and errors, raised from form scripts with the Client API.

Show me in the demoOpens the demo app with this component highlighted.

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 setNotification does.
  • 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

  1. Open the Form notifications section on the first accelerator.
  2. Select Show info, Show warning and Show error and read the banners at the top.
  3. Select Clear to remove all three.