Let’s talk Alteryx Copilot. Join the live AMA event to connect with the Alteryx team, ask questions, and hear how others are exploring what Copilot can do. Have Copilot questions? Ask here!
Start Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.

Service Now Input Tool Custom Query

SR
8 - Asteroid

HI All,

 

i am using the service now input tool to connect directly to SN tables to fetch data in alteryx workflows. However, one of the tables contains over 20M records and i need to figure out a way to filter the records before the input tool fetches all the records.

 

In the input tool there is an option for customer query but i am struggling with understanding the correct syntax.

 

Select * from task_sla where task = "e7962b741b6b89d4d68a0d0cf94bcb20";

 

i tried using this query where i want to pull records for the particular task id. however it is not working.

 

if anyone can help in figuring out the right query to filter the data i would be very helpful.

 

Thank You

SR

3 REPLIES 3
GrayDragon
5 - Atom

I sincerely hope you have figured this out, but for those who are also searching for the answer to this, I spent most of this afternoon trying a ridiculous number of variations.  May I point out that the Information text does NOT really help:

 

Alteryx ServiceNow Input Tool Custom Query InformationAlteryx ServiceNow Input Tool Custom Query Information

 

I tried so many variations with "sysparm_query=" at the beginning, which apparently you should NOT do.  I tried the display value, as the Information text shows, with and without double-quotes, to no avail.  I tried the sys_id value with and without quotes.  I finally got the expected results from this:

 

Alteryx ServiceNow Input Tool Custom Query Correct FormatAlteryx ServiceNow Input Tool Custom Query Correct Format

 

Hope this helps someone else from struggling!

GrayDragon
5 - Atom

It also took me a while to determine the correct syntax for multiple criteria, so I am also sharing what ended up working:

 

Alteryx ServiceNow Input Tool Custom Query Multiple CriteriaAlteryx ServiceNow Input Tool Custom Query Multiple Criteria

 

 

hugohugohugohugo
5 - Atom

Is there a way to filter on a datetime?

Trying opened_at > 2024-07-23 00:00:01 does not yield any results - it looks like the connection is pulling the whole table.

 

Thanks!

 

Just figured out the correct syntax:

opened_at>=javascript;gs.dateGenerate('2024-07-23','00:00:00')

 

This link was super helpful in determining how to create the query:

https://docs.servicenow.com/bundle/washingtondc-platform-user-interface/page/use/using-lists/task/t_...

 

More info on encoding custom query strings here:

https://docs.servicenow.com/bundle/washingtondc-platform-user-interface/page/use/using-lists/concept...

 

I hope this helps!

 

Labels
Top Solution Authors