Scripting
						
					
					
				
			
		
	
			
	
	
	
	
	
Options
			
				
					
	
			
		
	- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
05-07-2025 01:48 AM
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
	
		
		
			
			
			
					
	
			Options
			
				
					
	
			
		
	- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
05-09-2025 12:04 AM
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
Deepak Sharma
