Saturday, April 21, 2012

CRM 2011 Add notifications to entity form


CRM 2011: Notification area


function DC_Notification() {
    var attributes = Xrm.Page.data.entity.attributes;
    
    var notificationsArea = document.getElementById('crmNotifications');
    /*clear out notification area*/
    notificationsArea.SetNotifications(null, null);

    if (notificationsArea == null)
    {
        alert('div not found');
        return;
    }
    /*
    The integer is the notification type
    1 = Error
    2 = Warning
    3 = Info
    notificationsArea.AddNotification("<;unique value>;", 3, "","Your text here");
    */
    /*Create some notifications*/
    notificationsArea.AddNotification("1", 1, "1","Test 1");
    notificationsArea.AddNotification("2", 2, "2","Test 2");
    notificationsArea.AddNotification("3", 3, "3","Test 3");
}