CRM 2011 Custom Form Notification


The notification area on the CRM Form is a nice place to put information, warnings and critical information.

This can be easily done with the following javascript function:

addNotification = function (message, level) { 
var notificationsArea = document.getElementById('crmNotifications');
if (notificationsArea == null) {
alert('div not found');
return;
}

if (level == 1) { //critical
notificationsArea.AddNotification('mep1', 1, 'source', message);
}
if (level == 2) { //Info
notificationsArea.AddNotification('mep3', 3, 'source', message);
}
if (level == 3) { //Warning
notificationsArea.AddNotification('mep2', 2, 'source', message);
}
if(message == "")
{
notificationsArea.SetNotifications(null, null);
}

}

This will result in the following...

Comments (5)

  1. faisal Khowaja says:

    Hi John

    Thanks for sharing the code.

    I would like to know is that possible to have the CRMNotification on the customized tab level rather than on the top bar of form leve?

    if yes do you know how do i do that please?

    Thanks

    Faisal

  2. jsullyboy2 says:

    Hi Faisal. This is the using the OOTB notifications area so you can't relocate it. But you could put a web resource on the page in another location that works like the notificaiton area.

  3. jgrassan says:

    Hi John-

    If I want to display on the Opportunity Form based on a Picklist option, how would I do this? Create Webresource with code, then do I need to create message?

    Thanks for any guidance.

  4. jsullyboy2 says:

    You will put the function that I have above into a common Java Script library. You will associate that library to the opportunity form. Then add JavaScript to the OnChange event of the picklist field that you want to trigger the message. In the on change event you will look at the value of the picklist and set the message using the addNotification function above.

  5. RobotII says:

    I've updated the code to work with the new Polaris release, as the current version was not working for me. Prior to UR12, it was working fine. Changes can be found at my site (http://www.robotii.co.uk/…/getting-notifications-to-work-in-crm-2011-ur12). Perhaps you could update the post with the changes, if you think it appropriate.

Skip to main content