Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Client Script

Ram012
Tera Contributor

I'm new to ServiceNow

 

1.Write a code to print Caller : Manager , Location , Department ,Email with "GetReference".

 

 

2.Write a code to print Caller : Manager , Location , Department ,Email "without GetReference".

 

1 REPLY 1

Sohail Khilji
Kilo Patron

Hi @Ram012 ,

 

Recommend to use Glide Ajax but , As your requesting via getReference method:

 

 

function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading || newValue == '') {
        return;
    }

    g_form.getReference('caller_id', function(caller) {
        if (caller) {
            var infoMessage = 'Caller: ' + caller.name + '\n' +
                              'Manager: ' + caller.manager.getDisplayValue() + '\n' +
                              'Location: ' + caller.location.getDisplayValue() + '\n' +
                              'Department: ' + caller.department.getDisplayValue() + '\n' +
                              'Email: ' + caller.email;
            g_form.addInfoMessage(infoMessage);
        } else {
            g_form.addErrorMessage('Caller information could not be retrieved.');
        }
    });
}

 


☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....

LinkedIn - Lets Connect