We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

Caller is Vip or not

pragatishendre
Tera Contributor

Check if the caller is VIP or not. If Caller is VIP show alert as ‘Caller ‘-Caller Email ID-’ is VIP ’.
Without using GlideAjax, Write onLoad Client Script.
Using getReference in Client Script.

2 REPLIES 2

vermaamit16
Kilo Patron

Hi @pragatishendre 

 

Configure an On-Load Client Script on Incident table as below :

AmitVerma_0-1730773157743.png

 

function onLoad() {
    //Type appropriate comment here, and begin script below
    g_form.getReference('caller_id', function(ref) {
        if (ref.getValue('vip') == 'true')
            g_form.addInfoMessage(ref.name + '-' + ref.email + '- is VIP');
    });
}

Output :

AmitVerma_1-1730773376115.png

 

Thanks and Regards

Amit Verma

Thanks and Regards
Amit Verma

Hitoshi Ozawa
Giga Sage

@pragatishendre What you've requested.

 

function onLoad() {
    var caller = g_form.getReference('caller_id', function doAlert(caller) {
        if (caller.vip == 'true') {
            alert('Caller ' + caller.email + ' is VIP');
        }
    });   
}

HitoshiOzawa_3-1730774668795.png

 

Execution result:

HitoshiOzawa_2-1730774657184.png