Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

servicenow gliderecord lookup

//For a single record lookup from a sys_id
var gr = new GlideRecord("table_name");
if(gr.get("sys_id")){
	//use your record
	//gr.field_name = "new_value";
	//gr.update();
}

//For a single record lookup from a query
var gr = new GlideRecord("table_name");
gr.addQuery("field_name", "query");
gr.setLimit(1);
gr.query();
if(gr.next()){
	//use your record
}

//For multiple record lookups from a query
var gr = new GlideRecord("table_name");
gr.addQuery("field_name", "query");
gr.query();
while(gr.next()){
	//use your records
}
 
PREVIOUS NEXT
Tagged: #servicenow #gliderecord #lookup
ADD COMMENT
Topic
Name
7+8 =