September 2017
Intermediate to advanced
408 pages
9h 25m
English
Once we fire a query, the next important thing we need to be able to perform is iterating over the record set or query set retrieved from the database. Iterating over a query set can be done using the next() method, which acts as an iterator and returns true till there exists the next record; otherwise, returns false when there are no more records in the query set:
var gr = new GlideRecord('incident');
gr.addQuery('priority', '1');
gr.query();
while ( gr.next() ) {
gs.print( gr.getValue('number')+ " exists"); //number is a field in incident table // the getValue method returns string
}
Read now
Unlock full access