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

Hi @Bhuvan  ,

 

The export and import functions are not working as expected. When I export an attachment and try to import it into another instance, I'm getting file in unsupported or corrupted.

I believe this issue is occurring because the export and import are being done across two different instances. 

Could you please help me with some another way.


Thank you

@Pradeepa B 

you want to transfer files between instances right?

export import won't help here. you need to use REST Message and integration

if yes then check these links

Unable to send attachment via REST 

Business rule to send attachment to 3rd Party Tool via REST 

Send attachment via rest message 

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

@Pradeepa B 

 

Import and Export will not work for sys_attachment table as you are not trying to move the records from one instance to another rather actual attachments from the record. When attachments are moved it will be in binary format and you cannot directly transfer the attachments from one instance to another

 

Refer below article for more details on how attachments are stored in instance

 

https://www.servicenow.com/community/itsm-articles/copying-attachment-from-one-record-to-another-rec...

 

You need to use REST APIs or Custom action in Flow Designer to automate this. Refer below posts that can help with required scripts

 

https://www.servicenow.com/community/developer-forum/copying-attachment-from-one-instance-to-another...

 

https://www.servicenow.com/community/developer-forum/copying-attachment-from-one-instance-to-another...

 

As per community guidelines, you can accept more than one answer as accepted solution. 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

 

As per community guidelines, you can accept more than one answer as accepted solution. If my response helped to answer your query, please mark it helpful & accept the solution.

 

Thanks,

Bhuvan

Ankur Bawiskar
Tera Patron
Tera Patron

@Pradeepa B 

so do you want to sync attachments between Location records in those 2 instances?

what's your actual business requirement?

Usually we don't have any files attached to Location record as it's part of Core data in the instance along with other core tables such as Group, User, Department, Cost Center etc

If my response helped please mark it correct and close the thread so that it benefits future readers.

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