Query for records within a short period of time?

123456789456123
Kilo Contributor

I am having trouble with this query. I am trying to locate a record that was inserted within the last minute. Can someone help me build this query? I know I need to search for when it was updated on but I am having trouble figuring out the operator and value.

var gr = new GlideRecord('table');

gr.addQuery('sys_updated_on', ?, ?);

Should I be using either of the following:

minutesAgoStart() minutesAgoEnd()

any help would be appreciated.

Thank you.

1 ACCEPTED SOLUTION

Dubz
Mega Sage

Hi Ben,



You can use gs.minutesAgo(int) where int is the number of minutes ago you want to check.



GlideSystem Date and Time Functions - ServiceNow Wiki


View solution in original post

4 REPLIES 4

Dubz
Mega Sage

Hi Ben,



You can use gs.minutesAgo(int) where int is the number of minutes ago you want to check.



GlideSystem Date and Time Functions - ServiceNow Wiki


Thank you.


David,



Turns out I can't use this function with the scope I am working in. Do you have any other ideas?



Thank you.


Hi Ben,



Have look on developer.servicenow.com for the API methods available in scoped apps. The method on the link below might work for you but from a quick glance it looks like there are a few options that would fit your requirements.



https://developer.servicenow.com/app.do#!/api_doc?v=jakarta&id=r_ScopedGlideDateTimeSubtract_GlideTi...