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.

Get sys id by display value

hatazhix
Mega Expert

Hello,

I am making Business Rule that checks incident number and gets it's sys id.

Problem is how can i make a script that checks my display value for example "INCE0012345" as a query?

var inc = new GlideRecord('incident');

query that queries the display value and return sys id of this ince0012345

inc.addQuery("sys_id", 'this is ince0012345 sys id');
inc.query();
1 ACCEPTED SOLUTION

To display the sys_id you need to do:



var gr = new GlideRecord('incident');


gr.addQuery('number', 'INCE0014635');


gr.query();



while(gr.next()){


gs.print(gr.sys_id);


}



Regards,


Sergiu


View solution in original post

10 REPLIES 10

Hello Hai,


Is there an ACL preventing you from seeing that particular incident?