@dan_delaney

Basic GlideRecord Query

ServiceNow   JavaScript   GlideRecord

Just testing out GitHub pages for blogging, with a basic GlideRecord query for getting a list of all Priority 1 incidents:

1
2
3
4
5
6
7
8
9
10
// Get all priority 1 incidents
var incGR = new GlideRecord('incident');
incGR.addQuery("priority", 1);
incGR.addActiveQuery()
incGR.query();
if ( incGR.hasNext() ) {
  while ( incGR.next() ) {
    gs.info(incGR.number);
  }
}