Is it possible to import multiple XML at once?

Dan51
Giga Contributor

Hello!

Before a clone I export my update sets to xml, save them in a folder, then once the clone has happened import the xml one by one. This seems like a bit of a waste of time and that we are adding a human layer in here which could be prone to error.

Is there a way of automating this so it selects all my files from a folder or selecting multiple XML files to import so they run sequentially?

 

Thanks a lot!

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Dan,

Unfortunately you would require something custom for this i.e. 

1) setting up of mid server

2) write mid server script include which will fetch the xml files and upload in the instance

3) have a code similar to the one of applying update set i.e. preview, commit etc

So I think best method would be a human intervention to avoid any errors

Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

17 REPLIES 17

Santi Cots
Tera Contributor

Hi Dan,

What I do is to merge the files into one usin my laptop by using a simple script. Then I upload this single XML file with all the data.

It works to me.

Best

Do share!  🙂

 

 

Hi Santi,

Could you please share yours simple script that merge the files into one?

 

Thanks!

 

Here is the script I use (updated feb 2024):

 

#!/bin/sh

#Sample use: ./xmlmerge.sh './*.xml' > tot.xml

files=($1) # create array with files
first=${files[0]} # get the 1st element of the array

head -n 2 $first # get 2 lines from process the 1st element
for file in "${files[@]}"; do
tail -n +3 $file | grep -v '</unload>'
done
echo '</unload>'

Jason Siegrist
Giga Guru

We have multiple data XML exports, there has to be a better way to do a MASS import.