Write to CRM footer with JavaScript

191 Views Asked by At

I've noticed that when a mandatory field is not completed and a user attempts to save it adds a message to the form footer

Is it possible to do the same with JavaScript? For example, if I have a custom validation logic that fails (e.g. Start Date must occur within 6 months), is it possible and how would I add a validation message in the same location?

Default behavior

2

There are 2 best solutions below

0
Alex On

This (MSDN link) is the supported way of displaying custom notifications, similar to the ones that come up for required fields.

The linked MSDN is too long to copy-paste here, essentially we're looking at these functions:

Xrm.Page.getControl(arg).setNotification
Xrm.Page.getControl(arg).addNotification
Xrm.Page.getControl(arg).clearNotification
0
Arun Vinoth-Precog Tech - MVP On

Business rule can help. But you may need one more calculated field to achieve your need.