Get a first look at what's coming. The Developer Passport Australia Release Preview kicks off March 12. Dive in! 

PrashantLearnIT
Tera Sage

You may know that get() function can accept two arguments. When you pass two arguments, the first becomes the column for searching and the second is the value. But you should also know that get() can return multiple records based on the condition passed. So do not write your script under the assumption that get() will return only one record.

 

Script: 
var incident = new GlideRecord('incident');
if (incident.get('caller_id', gs.getUserID())) { //This returns more than one record
gs.print(incident.number);
incident.next(); //You can iterate to next record like a normal gliderecord query
gs.print(incident.number);
}

 

If my content helped you in anyway, please mark this content as BOOKMARK, SUBSCRIBE & HELPFUL

 

Best Regards,

Prashant Kumar (LearnIT)

 

YouTube Channel LearnIT: https://www.youtube.com/@learnitwithprashant

Blog LearnIT: https://medium.com/@LearnITbyPrashant

Prashant Kumar LinkedIn: https://www.linkedin.com/in/learnitbyprashant/

ServiceNow Community Prashant Kumar - https://www.servicenow.com/community/user/viewprofilepage/user-id/19635

1 Comment