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.

.

Kadasiddeshwar
Tera Contributor
 
5 REPLIES 5

Ankur Bawiskar
Tera Patron
Tera Patron

@Kadasiddeshwar  

Always use IF while using get() method, reason being -> if record not found it will give you any non-matching glideRecord object as well

If it matches multiple, it gives any 1 record

I believe @Chaitanya ILCR already shared how it gets and which record it gets, sorted by A to Z

var gr = new GlideRecord('incident');
if(gr.get('category','inquiry')){
gs.info(gr.number);
}

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

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader