ServiceNow GlideRecord "find"

 see docs

Example

This example shows how to find a record in the Incident table with "Critical" in the short description field.

var now_GR = new GlideRecord("incident");
now_GR.query();
var shortDescription = "Critical";
if (now_GR.find("short_description", shortDescription)) {
  gs.print("An incident with the specified field value was found");
  var recordID = now_GR.getValue("sys_id");
  gs.print("Found in the following record: " + recordID);
} else {
  gs.print("An incident with the specified field value was not found");
}

Output

An incident with the specified field value was found
Found in the following record: 552c48888c033300964f4932b03eb092


 

Comments

Popular posts from this blog

GlideRecord setValue

URL link in addInfoMessage