Search code examples
javaxmlweb-servicesservicenow

How to filter serviceNow incident records based on sys_updated_on


I'm using xml web service for service-now to query on the incident records. I'm using java and apache Httpscomponents to make calls. Since I am having a large number of records, In want to filter those records based on the sys_updated_on. What I tried is passing below uri to the HTTPGet

https://<instance>-now.com/incident.do?CSV&sys_param_query=active=true^sys_updated_onBETWEENjavascript:gs.dateGenerate(2016-12-01,03:50:00)@javascript:gs.dateGenerate(2016-12-01,03:55:00)

But this doesn't worked for me as it is returning all records, not the filtered ones. Can someone please tell me what I am doing wrong here and the correction too. Thanks


Solution

  • Found the solution from servenow.com only.

    https://<instance>-now.com/incident_list.do?sysparm_query=sys_updated_onBETWEENjavascript%3Ags.dateGenerate('2016-12-01'%2C'00%3A00%3A00')%40javascript%3Ags.dateGenerate('2016-11-20'%2C'23%3A59%3A59')
    

    or

    https://<instance>-now.com/incident_list.do?sysparm_query=sys_updated_onBETWEENjavascript%3Ags.dateGenerate('2016-12-01','00:00:00')%40javascript%3Ags.dateGenerate('2016-11-20','23:59:59')
    

    how did I found this? On your_instance.servicenow.com, when we press on the filter button, a filter line is shown in its right, right click on that and select copy url. Attached is the image for same. query query