Show custom warning messages on Microsoft Dynamics CRM

Using JavaScript is a quite common approach for client side validation and interaction on the Microsoft Dynamics CRM forms. In many occasions we need to notify or warn the user about a condition or situation depending on certain values of some fields in the form. Normally you would use a JavaScript alert to show a dialog with the warning notification, this can be quite annoying for the users if they keep continuously facing this warnings.

Microsoft Dynamics CRM has a internal nice way of doing it by adding a yellow background warning message on top of the form, like in the picture below.

image

After a question on the Dynamics CRM Forums I’ve been playing a little bit with this an created a small JavaScript snippet that can be used to enable our client side code to achieve the same effect showing warning messages.

The code consist of a function called ‘addNotification’ that allows you to add a new notification message with the same visual style as the Dynamics CRM ones. This function uses the Notification area that is included on an Entity form to display the message with the same visual style.

Once you have added the declaration of the ‘addNotification’ function to the OnLoad you can call it either from the Onload or any OnChange event to provide warning messages to the user without using the typical JavaScript alert approach. The result will be the same as the one shown in the screen capture below.

image

6 thoughts on “Show custom warning messages on Microsoft Dynamics CRM

  1. Utilizar JavaScript es una técnica bastante común en Microsoft Dynamics CRM para realizar

  2. Thank you very much. Copy, paste, and working, not easy to find code like that around…

  3. It looks like a very nice idea that will save few user clicks then it would be great if we know where to find the source code for this addNotification function..

  4. Pingback: Getting Notifications to work in CRM 2011 UR12 - RobotII

Leave a Comment Yourself

Your email address will not be published. Required fields are marked *