- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-02-2020 07:13 AM
Hi All,
Need help. I am trying to build a dynamic query where sys_created_on is passed to the table using the sysparam=sys_created_on attribute. Now my question here is how to build this query.
Source= Json.Document(Web.Contents("https://servicecentral.capgemini.com/api/now/table/prolem",
[Query=sysparm_query=sys_created_on%3E%3Djavascript%3Ags.dateGenerate(dtquery)]))
where dtquery is the date variable holding the date value.
Just to add I am using this query to get data into power bi using power query.
Please guide
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-02-2020 07:28 AM
you should send it like this
Send the date as dynamic value which is highlighted in bold
sysparm_query=sys_created_onON2020-07-17@javascript:gs.dateGenerate('2020-07-17','start')@javascript:gs.dateGenerate('2020-07-17','end')
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-13-2021 06:28 AM
The query which you have provided works from postman and api explorer but not from tool I'm trying to integrate with..not sure what could be the cause.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-13-2021 06:55 AM
possibly check the character encoding or any special character getting replaced etc
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-02-2020 07:31 AM
this should be something like below.
sysparm_query=sys_created_on<javascript:gs.dateGenerate('2020-08-01','00:00:00')
make the changes in < or < based on your need.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-03-2020 12:58 AM
Hope you are doing good.
Let me know if that answered your question.
If so, please mark appropriate response as correct & helpful so that this thread can be closed and others can be benefited by this.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-14-2024 01:26 AM
how to set timezone? it automatically assumes that the date time given is in local timezone but we need to set it as UTC
