how to query incidents in ServiceNow, which updated or created in last 5 minutes?

Amiku1
Kilo Contributor

Hi Experts,
I have a use case, where I need to query ServiceNow incidents, which updated or created in the last 5 minutes. i.e- my query should get me only those records which either created or updated within 5 minutes, with the current time. I am using the ServiceNow API:- https://docs.servicenow.com/bundle/geneva-servicenow-platform/page/integrate/inbound_rest/reference/r_TableAPI-GET.html . here in the "sysparm_query" parameter, what query I should pass to get the records that were updated or created in the last 5 minutes.
sysparm_query = <how to form the query>
Any help will be much appreciated.

Thanks,
Amit Kumar

1 ACCEPTED SOLUTION

Geoff_T
Mega Sage

Hey,

On the incident table build up a query like:

find_real_file.png

Right click the end of the query to copy query and you get:

sys_updated_onRELATIVEGT@minute@ago@5^ORsys_created_onRELATIVEGT@minute@ago@5

 

Pass this encoded query as your sysparm_query value.

 

Geoff

View solution in original post

2 REPLIES 2

Geoff_T
Mega Sage

Hey,

On the incident table build up a query like:

find_real_file.png

Right click the end of the query to copy query and you get:

sys_updated_onRELATIVEGT@minute@ago@5^ORsys_created_onRELATIVEGT@minute@ago@5

 

Pass this encoded query as your sysparm_query value.

 

Geoff

Amiku1
Kilo Contributor

Thanks Geoff, it working & i am getting the updated records.