Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How To write Query for incidents opened on today

jenny32
Tera Guru

Hi,

I am trying to display by using

var inc = new GlideRecord('incident');

  inc.addQuery('opened_at', today);

      inc.query();

But, am not getting output for this.

If Any one aware of this help me.

Regards,

jennifer

1 ACCEPTED SOLUTION

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hi Jennifer,



Here you go.


var inc = new GlideRecord('incident');


inc.addQuery('active=true^opened_atONToday@javascript:gs.daysAgoStart(0)@javascript:gs.daysAgoEnd(0)');


inc.query();


while(inc.next())


  {


  gs.addInfoMessage(inc.getRowCount());


}


View solution in original post

3 REPLIES 3

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hi Jennifer,



Here you go.


var inc = new GlideRecord('incident');


inc.addQuery('active=true^opened_atONToday@javascript:gs.daysAgoStart(0)@javascript:gs.daysAgoEnd(0)');


inc.query();


while(inc.next())


  {


  gs.addInfoMessage(inc.getRowCount());


}


Hii Pradeep,



Thanq, Now the Code is working.



Regards,


jennifer.


Perfect