Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

john_andersen
Tera Guru

ServiceNow offers a number of out-of-box ways to export its data. However, other than the ODBC driver, all of the export mechanisms have record limits placed on them so as not to bring down the instance when exporting a large number of records from a table. The XML Web Service, however, does have some capabilities that allow you to easily and reliably chunk the requests using paged queries. Using the wiki documentation on exporting large amount of data, you can get the general feel for how to leverage the XML web service processor to export the full contents of a table in a paged manner so as to use several smaller requests that don't bring the instance to its knees.

Essentially, through a series of request parameters, you sort the data on a field in the table. In most cases this would be the sys_id field. You also give it a max number of records to return in a given request. Finally, you specify a beginning value to start with in each given request (eg. use the last value of the sorted field from the previous request made). Optionally, you can choose to have the data exported in "unload" format that shows both Display Values as well as sys_id values. You can also filter the data before exporting it so that you only bring in data that matches certain criteria.

Any REST based client should be able to export data in this manner as long as it can read the response and generate a new request based on the last record that was brought over.

In order to show you how this is done, I have created a Perl Script/Utility that allows you to quickly and easily export data from a ServiceNow table into a file on your file system. Read more on my personal blog: Using Perl to Export Data from a ServiceNow Table