Copy attachment from one instance to different instance

Pradeepa B
Tera Contributor

Hi,

 

I need to copy attachment from one instance to different instance under table cmn_location.

Could you please help me on this requirement.

 

Thank you

11 REPLIES 11

G Ponsekar
Giga Guru

Hi @Pradeepa B ,

 

The recommended way to copy attachments from one ServiceNow instance to another is using the REST Attachment API. The process involves retrieving the attachment's metadata and content from the source instance and then uploading it to the target instance via a server-side script. 
This method is suitable for a one-time migration or a scheduled integration. 
 
High-level steps
  1. Source Instance: Create a script (e.g., a Fix Script or Scheduled Job) to find the attachments for cmn_location and use RESTMessageV2 to make API calls to the target instance.
  2. Target Instance: Ensure the REST API is set up and authenticated, and the user has permissions to write attachments.
  3. Authentication: Both instances must be authenticated with each other. Basic Authentication or OAuth is required. Basic Auth is simpler for one-time scripts.

 

If I could help you with your Query then, please hit the Thumb Icon and mark as Correct !!

 

Thanks, GP

Bhuvan
Mega Patron

@Pradeepa B 

 

Go to sys_attachment table and filter by table name cmn_location. If you want to perform manual activity, you can export XML or export set and import it in target instance under same table sys_attachment.

 

Bhuvan_0-1757431344740.png

You can automate this via Flow or Export Set as well but if it is a one-off activity, manual steps would be the ideal way to do it.

 

If this helped to answer your query, please mark it helpful & accept the solution. 

 

Thanks,

Bhuvan

@Pradeepa B 

 

Did you get a chance to review this as I believe information provided would fulfil your requirement. If your question was not framed correctly and you want to move cmn_location table data from one instance to another, you can export XML from source instance and import in target instance.

 

Export Records

Bhuvan_0-1757479646091.png

Import Records

Bhuvan_2-1757479704410.pngBhuvan_3-1757479717440.png

If my response helped to answer your query, please mark it helpful & accept the solution.

 

Thanks,

Bhuvan

@Pradeepa B 

 

Did you get a chance to review this as I believe the information provided should answer your question

 

If my response helped to answer your query, please mark it helpful & accept the solution.

 

Thanks,

Bhuvan