Adding conditions to an URL

Peekster
Kilo Explorer

Hello everybody.

At the moment I am trying to pull data from a service now instance through a .net script that was provided by the Service Now wiki.

In that script is a url to which the script runs to get its data. In my case i get the data in a CSV format.
Since I run my request to the instance on quite a large table I am trying to get the following done:

In Service Now you can set filters on a report on what rows to include or not. Such as "fieldname" CONTAINS "value" or "updated" is "Last Week"
Can somebody help translating such conditions in to the url I can use in my .net script?
The url I have at the moment is: https://instancename.service-now.com/tablename.do?CSV

On the wiki examples are provided such as: sysparm_query=priority=1
But now im looking for something to add to my link to be able to get those previously mentioned conditions in.

Hope you guys can help!

2 REPLIES 2

jason_petty
Tera Expert

You would want an encoded query in your url. Here is an example (all incidents that contain "insurance" in the short_description field AND are updated in the last week:
http://instance/incident_list.do?sysparm_query=short_descriptionLIKEinsurance^sys_updated_onONLast%20week%40javascript%3Ags.beginningOfLastWeek%28%29%40javascript%3Ags.endOfLastWeek%28%29&CSV

The way you can create this is:
1. Pull up the list in your instance, then expand the filter at the top and create your filter with the parameters you want.
2. Run the filter
3. Now right click on the bread crumb at the top (last node of the bread crumb) and chose copy URL
4. Add the &CSV to the end of that URL

That should get what you want.


Peekster
Kilo Explorer

Just before you posted this I figured this out!

Thank you anyway!