THURSDAY, JANUARY 19, 2017

The Simple Power of XML Export/Import

Service-now.com makes extensive use of the XML format for storing and transporting system updates and changes. Update sets, System Import Sets, and certain export methods all make use of XML files in one way or another. One feature that a lot of people don’t know about until somebody shows them is the ability to export and import XML files in a Service-now instance. A manual XML import/export can be extremely helpful in the right circumstances and is something that every Service-now consultant or administrator should have in their tool belt. In this post, I’ll explain how simple it is to transport system changes from one Service-now instance to another with a few clicks.

First of all, I don’t recommend using this method as a full-time replacement for update sets or import sets between instances. Those methods are much better for bulk changes and much less prone to user error when configured and used correctly. This method is completely manual, but it is really nice to know about if you’ve got something that you need to do one time – maybe something got left out of an update set or you need to pull a record from the Service-now demo instance.

It’s also critical when using this method that the sys_ids of any record you import match between the source and target if the target record needs to be updated. The sys_id is the coalesce value used to match records and indicates that an update should occur rather than an insert. This article shows how you can view the record sys_id values to make sure they match.

XML Export (Single Record from a form)

If you need to export a single record the easiest way to do it is simply to open up the record and right-click the form header as shown below. The export will ask you to save an XML file which can be imported in another Service-now instance.

XML Export (Multiple Records or Single Record from a list)

You can also export to XML from any full table list (it doesn’t work from related lists on a form). Exporting from a list allows you to filter down to multiple records (or even a single record) that you want to export. Anything that shows in the filtered list will be part of the export. The export option is accessed by right-clicking the list header as shown below.

XML Import

Once you have an XML export using one of the methods described above, you can import that XML file into any Service-now instance by right-clicking any full list header (it doesn’t work from related lists on a form) and selecting the ‘Import XML’ option. Since your XML file contains all of the details about the record(s) included you don’t have to worry about where you initiate the import from. For example, I could import a business rule export using the context menu from a list of users. The system knows from the details of the XML file where the records really need to go. It also doesn’t care if the import contains one or multiple records. The process is the same for both. Any record(s) that don’t exist in the destination instance will be created and any that already exist will be updated – AS LONG AS THE SYS_ID VALUES MATCH.

There are some cases when the functionality you are exporting is actually contained in several different tables. If you don’t have to export from these places frequently, it may be good enough simply to export from all of the individual tables as shown above. If it’s something you do frequently, you may want to consider creating a custom UI action to accomplish the task. Instructions for that can be found here.

4 Comments

Ahmed Hmeid 07-03-2012, 07:14

Hi Mark,

I was wondering if there is any way that you know of to export to other formats (preferably doc or odf)?

Thanks,
Ahmed

Reply
Mark Stanger 07-03-2012, 07:50

There’s no way currently. You should contact ServiceNow support for an enhancement on this.

Reply
david 13-09-2012, 14:54

Worth noting that you have to escalate your permissions to “security_admin” before the Import XML right click option will appear.

Reply
Mark Stanger 15-09-2012, 07:00

I hate that change, but you’re absolutely correct. Thanks for pointing that out!

Reply

Leave a Reply


Latest Comments

  • David: It appears that I can hit sys_properties table with REST. This works, but I haven’t yet discovered the...
  • Mark Stanger: Hey David, It doesn’t surprise me that scoped apps have made this more difficult. I’m not...
  • David: Mark, do you have an example of how to do this in a scoped app? It seems there are many hoops to jump through...
  • Mark Stanger: The only possibility is to create a system property to override this in your application. Check out the...