Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

Passing sys_created_on date parameter in REST api

Raks
Tera Contributor

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

 

 

 

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron

@Raks 

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

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 10x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

9 REPLIES 9

Ankur Bawiskar
Tera Patron

@Raks 

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

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 10x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Hi Ankur

Can we pass any variables date in place of those bold dates? 

Hi Ankur,

 

How can we pass sysparm_query greater than some date ?

you can manipulate the date

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 10x ServiceNow MVP  ||  ✨ ServiceNow Community Leader