Thursday, August 16, 2012

Showing custom Alerts in notifications area

If you need to write your alerts in javascript using the notifications area it really easy, here’s an example

var mep = 1;
 
function set_alert() {
    var notificationsArea = document.getElementById('crmNotifications');
    if (notificationsArea == null) {
        alert('div not found');
        return;
    }
 
    if (mep == 1) {
        notificationsArea.AddNotification('mep2', 2, 'source', 'Warning message');
        notificationsArea.AddNotification('mep3', 3, 'source', 'Info message');
        notificationsArea.AddNotification('mep1', 1, 'source', 'Critical message');
        mep = 2;
    }
    else {
        notificationsArea.SetNotifications(null, null);
        mep = 1;
    }
}

Here’s an image of the result

 

 

Thanks & Regards,

K V SambasivaRao

 

No comments: