The Simple Power of XML Export/Import

///The Simple Power of XML Export/Import

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.
By | 2018-07-09T15:00:05+00:00 November 4th, 2010|Categories: Imports|Tags: , , |4 Comments

About the Author:

Mark has worked in the IT industry since 2002 and with ServiceNow since 2007. He is the founder and creator of SN | Guru and the co-founder of Crossfuze, one of the worlds leading ServiceNow consulting partners. Prior to co-founding Crossfuze, he worked for ServiceNow as a Senior Architect on the Professional Services team. He has personally led dozens of successful implementations encompassing every part of the ServiceNow platform. He is also responsible for designing and developing groundbreaking ServiceNow solutions and best practices in the form of various applications, turnkey solutions, and integrations during his tenure at ServiceNow, Crossfuze and, of course, SN | Guru. These solutions are used today by ServiceNow administrators and consultants alike in hundreds of ServiceNow instances around the world!

4 Comments

  1. Ahmed Hmeid March 7, 2012 at 7:14 am - Reply

    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

    • Mark Stanger March 7, 2012 at 7:50 am - Reply

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

  2. david September 13, 2012 at 2:54 pm - Reply

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

    • Mark Stanger September 15, 2012 at 7:00 am - Reply

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

Leave A Comment