Query parameters in the End point URL
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-16-2022 04:05 AM
I have 2 fields Begin date and End Date
How to query the records based on the(begin date <= Today and End Date >= Today) in REST Messages using the GET
Tried with the below code in Script include;
var gdt = new GlideDateTime(gs.nowDateTime());
var tdydate = gdt.getDate();
var filter = '%24filter%3DBegindate%20le%20DateTime%27'+tdydate+'T00%3A00%3A00%27%20and%20Enddate%20ge%20DateTime%27'+tdydate+'T00%3A00%3A00%27';
Thanks in advance
- Labels:
-
Integrations

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-16-2022 04:09 AM
Can you try
start_date<=javascript:gs.endOfToday()^end_date>=javascript:gs.beginningOfToday()
Replace start_date & end_date as per your field name
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-16-2022 04:43 AM
We are integration with SAP we need to pass this filter in query parameters in URL.
This looks fine in Servicenow Query

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-16-2022 04:54 AM
I understand but all you need is to navigate to
System Webservices >> REST >> REST API Explorer
Select a table & the copy the encoded query
I did try & got something as below
https://abc.service-now.com/api/now/table/change_request?sysparm_query=start_date%3C%3Djavascript%3Ags.endOfToday()%5Eend_date%3E%3Djavascript%3Ags.beginningOfToday()&sysparm_limit=1
Where abc is my instance name. Use above & just replace start_date & end_Date & table name accordingly
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-16-2022 05:27 AM
Thanks for the reply
Tried it, not working
We are apply filter on the 3rd party system(servicenow to SAP) using the GET method
Trying to filter with the the URL