Moving a table records with attachments to another table in another instance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2023 06:40 AM
Hi, I have a requirement to move a table records with attachments to another table in different instance. I need some guidance, how can i do this.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2023 04:05 AM
So you are going for integration 😉
Assumptions:
- you know exactly how to select source records
- you know the data structure of target table (on remote instance)
- if needed - you know the field value mappings (source: Category = Hardware is target: Category = Equipment)
The generic approach is quite straightforward:
Iterate through source records and for each source record:
- push record to remote instance (if needed translate source values to match target values)
- identify all attachments linked to source records
- push all attachments to target table (on link those with remote copy of your local record)
I was doing very similar exercise recently and I went for Flows with usage of ServiceNow Remote Instance Spoke. After doing the configuration as described in KB0951925 you have access to multitude of Flow actions like:
- Create Remote Record
- Create or Update Remote Record Using Import Set
- Copy Attachment To Remote Instance
Using this spoke simplifies the technical implementation and limits the amount of custom code. In addition to that, as this is in Flow Designer, testing and validating solution is very easy.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2023 06:25 AM
Hi Pawal1,
is it same way like export related attachments from sys_attachment table to excel file and then import via load data--> transform map, my target table name and sysid is different, how do i map the attachment to records moved that has same number in both source and target table.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2023 02:14 PM
Nope - I'm considering here building a REST based integration and pass the records with attachments by pushing transactions to proper endpoints.
Exporting sys_attachment table to excel will only get you a list of attachments but not a the actual files.
With Remote Instance Spoke (in Flow Designer) the basic idea looks like that (please note that I.m using incident table just as example):
This is ofc basic idea - requires some error handling and proper setup but the complete data transfer can be handled with just couple of actions.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2023 06:31 AM
Hi Pawal1,
Is it same way like export related attachments from "sys_ attachment" table to excel file and then import via load data--> transform map? my target table name and sys id is different, how do i map the attachment to records moved that has same number in both source and target table.