I have known for quite some time that you can export records from any table from a URL (assuming you have rights to access that table). Several months ago, I discovered that you could not only get list information, but you could also filter it. Today, I found out that beyond filtering, you have the power to group the list results from the filter.

Let me explain how to use filters and groups with Service-now.com list URL’s.

According to the Service-now wiki on the “Exporting Data” page, you can export a number of records from a service-now table by appending a processor at the end of the URL. For example, if I want to export the records in the incident table as XML, I would format my URL like so:

http://myinstance.service-now.com/incident.do?XML

I could also export it into a CSV file in the following (and similar) way:

http://myinstance.service-now.com/incident.do?CSV

Now, what if I wanted to filter out the results a little bit. For example, what if I only wanted to export the “Active” incidents?

In order to use a filter in your export, you append the following parameter in the URL: “sysparm_query”. For example, if you wanted to export all active incidents into XML, you would use the following URL:

http://myinstance.service-now.com/incident.do?XML&sysparm_query=active=true

Let’s say you also want to only show those incidents where the category field is set to “hardware”. You can add this field to the query by using the “^” character between filter fields. Here is this example below:

http://myinstance.service-now.com/incident.do?XML&sysparm_query=active=true^category=hardware

Now let’s say we want to group those results by priority such that the priority 1 items will all be shown together (and so on for all other priorities). In order to do this, you use the keyword: EQ^GROUPBY just before the field that you wish to group results to. See the example below:

http://myinstance.service-now.com/incident.do?XML&sysparm_query=active=true^category=hardware^EQ^GROUPBYpriority

For an added bonus, you can make all of your exported reference fields show display values instead of ID numbers for their target tables by adding the following parameter to your URL: “displayvalue=true”.

If we wished to do this for our filtered group created in this article, we could simply append the parameter to the url like so:

http://myinstance.service-now.com/incident.do?XML&sysparm_query=active=true^category=hardware^EQ^GROUPBYpriority&displayvalue=true