Incident

P1234
Tera Contributor

Hi Everyone,

 

I want to print the all incidents account & incidents managers names.

 

I build the code but not working.

 

var inc = new GlideRecord('incident');
inc.addQuery('sys_id','57af......')
inc.addExtraField('caller_id.manager.manager.name');
inc.query();
if(inc.next()){
gs.print("Caller's Manager's Manager Name: "+inc.caller_id.manager.manager.name);
}
 
Any idea please let me know.
5 REPLIES 5

Mark Manders
Mega Patron

What is your business case? What are you using this for?


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

Shruti
Mega Sage
Mega Sage
var inc = new GlideRecord('incident');
inc.addActiveQuery();
inc.addExtraField('caller_id.manager.manager.name');
inc.query();
while(inc.next()){

gs.print("Caller's Manager's Manager Name: "+inc.number + " " + inc.caller_id.manager.manager.name);
}

GlideFather
Tera Patron
var inc = new GlideRecord('incident');
inc.addQuery('sys_id','57af......')
inc.addExtraField('caller_id.manager.manager.name');
inc.query();
if(inc.next()){
gs.print("Caller's Manager's Manager Name: "+inc.caller_id.manager.manager.name);
}
 
The highlighted row seems to query just one particular record...
 
Why do you need a background script for this? you can navigate to the list view and set the conditions without using script...
———
/* If my response wasn’t a total disaster ↙️ drop a Kudos or Accept as Solution ↘️ Cheers! */


GlideFather
Tera Patron

@P1234 
install the SNUtils extension unless you already have it and then go to the list - Incident, click the gear icon for personalising your view and double click an empty space, a new line will be added and put your dot walking and pres enter, it will add the dotwalking field as a new column and you can export it or review it whatever...

Incident > Gear Icon > double click the area below the box and PRESS ENTER (otherwise not applied):

KamilTEL_0-1751022761467.png


Result:

KamilTEL_2-1751022894482.png

 

 

Or you can add the field there for the whole view, this is personalised just for your own view, not anybody else's.

FYI @Mark Manders my favourite hidden trick by SNUtils :)))))   

 

———
/* If my response wasn’t a total disaster ↙️ drop a Kudos or Accept as Solution ↘️ Cheers! */