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 get last 15 min from now

niharikayb
Kilo Contributor

Hi,

At present I am quering the input date with todays date .My code(Business rule) is :

  var date = gs.nowDateTime();

  var inv =new GlideRecord('u_hpam_inventory_control_1');

  inv.addQuery('u_input_date',date);

But i want to query the input time with last 15 min whenver the business rule start..

Please help me out

Thanks in Advance !

1 ACCEPTED SOLUTION

Anurag Tripathi
Mega Patron
Mega Patron

inv.addEncodedQuery('sys_created_onONLast 15 minutes@javascript:gs.minutesAgoStart(15)');


-Anurag

View solution in original post

3 REPLIES 3

Anurag Tripathi
Mega Patron
Mega Patron

inv.addEncodedQuery('sys_created_onONLast 15 minutes@javascript:gs.minutesAgoStart(15)');


-Anurag

Thanks Anurag


Patricio Javier
Tera Expert

 

You can form the query in the data list, and then copy it with right click

find_real_file.png

 

Code:  current.addEncodedQuery('tablename=incident^ORtablename=sc_request^ORtablename=sc_req_item^ORtablename=sc_task^sys_created_onONLast 15 minutes@javascript:gs.beginningOfLast15Minutes()@javascript:gs.endOfLast15Minutes()^ORsys_created_onONCurrent minute@javascript:gs.beginningOfCurrentMinute()@javascript:gs.endOfCurrentMinute()');