Export directly from a URL
Dynamically export data from a script or web service by building a URL query.
Before you begin
Role required: None
Note: ServiceNow enforces basic authentication for direct URL access. The data extracted from the URL contains only the fields to which the currently authenticated user has read access.
About this task
You can use URL queries to generate filtered lists of records programmatically before exporting them. URL queries are useful for scripts that generate a list of records or when no user can manually add the filter from the UI.
You must be familiar with the ServiceNow table and column names to export data directly from the URL. See Navigate to a record or a module using a URL.
You can control whether to export the display value or raw value of fields and the field label or field name for headers using query parameters or system properties.
- For details on using query parameters, see .
- For details on using system properties, see .
Query parameters, if present, override system properties.
Procedure
Specify the instance URL.
For example:
https://<instance name>.service-now.com/Specify the table form or list to export.
For example:
incident_list.doSpecify the export format processor to use for the export.
You can specify CSV, XLS, JSON, XLSX, or XML. For example:
?CSVNote: The XML processor in a URL export doesn't export attachments or journal fields. To export attachments and journal fields like the Work Notes or Additional Comments fields, export the records from a list by using the Export > XML option in the context menu.
Query for specific records by adding the sysparm_query parameter.
The required syntax is
sysparm_query=[column name][operator][value]. For example:https://<instance name>.service-now.com/incident_list.do?XML&sysparm_query=priority=1Note: All queries use a column name, an operator, and a value. See Condition Builder for a list of available operators.
Sort the records by column name using the sysparm_orderby parameter.
The required syntax is
sysparm_orderby=[column name]. For example:https://<instance name>.service-now.com/incident_list.do?XML&sysparm_query=priority=1&sysparm_orderby=assigned_toNote: You can sort by only one column using sysparm_orderby. To sort by multiple columns, use multiple orderby entries. For example:
sysparm_query=ORDERBYassigned_to^ORDERBYpriorityExport fields from a specific view using the sysparm_view parameter.
The required syntax is
sysparm_view=[view name]. For example:https://<instance name>.service-now.com/incident.do?CSV&sysparm_view=essThis URL exports incident fields visible from the Self Service (ess) view.
- By default, exporting data from a list exports only the fields that are visible from the current view. If you want to export fields from another list view, you can switch views from the UI. See View management.
- If you're exporting CSV or Excel data and don't specify a view, the export uses the default list view.
- If you're exporting XML data, all fields are exported by default unless you specify a particular view.
- Export specific fields from the table using the sysparm_fields parameter.
The required syntax is
sysparm_fields=[field1],[field2]. For example:https://<instance name>.service-now.com/incident_list.do?CSV&sysparm_fields=sys_id,numberExport all fields from the table, including the sys_id, using the sysparm_default_export_fields parameter.
The required syntax is
sysparm_default_export_fields=all. For example:https://<instance name>.service-now.com/incident_list.do?CSV&sysparm_default_export_fields=allThe sysparm_default_export_fields parameter has no effect on XML exports unless you include the sysparm_view parameter to specify a non-default view.
Sample URLs
| URL | Description |
|---|---|
| https://<instance name>.service-now.com/incident_list.do?CSV | Export all incidents to a comma-separated value text file. |
| https://<instance name>.service-now.com/incident_list.do?CSV&sysparm_query=sys_id%3E%3Db4aedb520a0a0b1001af10e278657d27 | Export a particular incident to a comma-separated value text file. |
| https://<instance name>.service-now.com/incident_list.do?CSV&sysparm_orderby=sys_id | Export all incidents to a comma-separated value text file and sort the list by sys_id. |
| https://<instance name>.service-now.com/incident_list.do?XML&sysparm_query=priority=1&sysparm_orderby=assigned_to | Export a list of all priority 1 incidents to an XML file and sort the list by Assigned to field. |