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
Tera Patron

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

Shruti
Giga 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...

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 :)))))