Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

Scripting

P1234
Tera Contributor

Recently I attended interview in MNC company.

Panel is asked

1.To write a code to identify  Caller : Manager ,Department ,Location using GetReference one method.

 

2.without GetReference

Any idea without using GetReference to print Caller Manager,Location,Department.

1 REPLY 1

Deepak Shaerma
Kilo Sage
Kilo Sage

Hi @P1234 

You can print the Callers related any details using this format in bg: 

var callerID = '62826bf03710200044e0bfc8bcbe5df1';  //sys_id of the user
var caller = new GlideRecord('sys_user');
if (caller.get(callerID)) {  //you can use current.caller_id as well
    var manager = caller.manager.getDisplayValue();  
    var location = caller.location.getDisplayValue(); 
    var department = caller.department.getDisplayValue();
    
    gs.info('Manager: ' + manager);
    gs.info('Location: ' + location);
    gs.info('Department: ' + department);
}

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards
Deepak Sharma