Migrate attachments

matt v_
Mega Expert

I feel like I've gotten myself into something very complicated...

Background

Earlier this year, we spun up a new instance and essentially started over with our key departments: IT, HR, Legal, and Facilities.   Due to some heavy rebuilding of case/incident/request forms, we did not want to try and shoehorn the old data into the new instance.   Instead, I have exported all the old records as XLS and created new "archive" tables for these in our new instance and imported them all as plain text in most cases.

Current Problem

The struggle now is attachments.   I do have XML exports of all the old records, but I don't think that will help me here.   I've found a few old threads about how attachment data is stored and it seems pretty intense.   I'm not sure how I can pull this data out and re-map it to the new records that were created.   Due to exporting XLS, the old Sys IDs are not present.   I did keep the old record numbers in a new field, but the new records have their own numbering system.

Questions

  1. Which tables do I absolutely need exported to accommodate this?   (I've already grabbed sys_attachment data for each related table)
  2. How can I get the attachments tied to the new "archive" records?
1 ACCEPTED SOLUTION

matt v_
Mega Expert

For anyone curious, I wasn't able to do this nicely.   I probably could have messed with grooming XML files, but that was a daunting task and the XML for this list of requests was over 1GB and I could not get it to open in an editor (yes, I tried a few).



I was able to successfully migrate one attachment, but it required swapping around some SysIDs and ended up being too much manual effort.   Instead, I found an article on how to add a UI Action to download all of a records attachments as a single ZIP file.   Since there are 514 records in question (and most have attachments), the department has assigned a couple of folks to go through and download what they need one record at a time.



Not ideal, but this will still be less effort than what I was trying to accomplish.   I've already spent far too much time trying to make this a clean import task.



Thanks for the suggestions!


View solution in original post

4 REPLIES 4

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hello Matthew,



You may find the below blog helpful.


https://snprotips.com/blog/2016/2/25/understanding-and-using-glideattachment#1


Thanks for the link.   That's one that I have read through previously, but it was a bit over my head.   I am not very advanced when it comes to scripting at this point, and I am not sure how to adapt this to use with several thousand records.


Hi mathew,



Maybe this might be helpful:


Migrating Attachments Between Instances


matt v_
Mega Expert

For anyone curious, I wasn't able to do this nicely.   I probably could have messed with grooming XML files, but that was a daunting task and the XML for this list of requests was over 1GB and I could not get it to open in an editor (yes, I tried a few).



I was able to successfully migrate one attachment, but it required swapping around some SysIDs and ended up being too much manual effort.   Instead, I found an article on how to add a UI Action to download all of a records attachments as a single ZIP file.   Since there are 514 records in question (and most have attachments), the department has assigned a couple of folks to go through and download what they need one record at a time.



Not ideal, but this will still be less effort than what I was trying to accomplish.   I've already spent far too much time trying to make this a clean import task.



Thanks for the suggestions!