This is another new feature of Dynamics CRM 2013. While in previous versions, we used to use JScript alerts to bring up field specific messages on forms, now we have two new functions available:
So how do we use then, and what do they do?
First off, let’s bring up a message on a field if a condition is met, or clear it otherwise:
function SetCustomNotification(controlName, controlMessage)
var field = Xrm.Page.getControl(controlName);
var condition = [evaluate your condition here];
Pass in strings for controlName and controlMessage.
Set your function on either the onChange event of the field, or on the onSave event of the form. If you set it on form save, it’s a good idea to stop the save if the condition fails and the message comes up.
And the end results is your custom message showing as below:
I think the same can be achieved using business rules.
In a very simplistic manner, yes, you can use business rules for the same functionality. What the example shows can easily be achieved using business rules. Where this becomes a valid alternative, is if you need to insert additional complex rules around the message you intend to display. This could be either the relationship to other fields on the form, using regex, etc.