How move attachments from one table table to another table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-14-2020 06:32 AM
Hello,
We will be using 2 different customized tables far attachment functionality and in future would like stop using one of them. Currently records have attachments and we are thinking to migrate existing attachments to another customized table so that we can use only one functionality effectively. Could you please someone to help on this to how to proceed with the migration without loosing attachments?
Thanks,
Kiran
- Labels:
-
Script Debugger

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-14-2020 06:46 AM
Hello Kiran,
You can create a fix script/Background script to loop through records and then push attachments via GlideSysAttachment.
Copy attachments from record to record
GlideSysAttachment.copy('sourcetable','sys_id','destinationtable','sys_id');
Please refer https://snprotips.com/blog/2016/2/25/understanding-and-using-glideattachment#4
- Pradeep Sharma

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-18-2020 06:13 AM
Hi Kiran,
Let me know if that answered your question. If so, please mark my response as correct so that others with the same question in the future can find it quickly and that it gets removed from the Unanswered list
- Pradeep Sharma
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-27-2021 08:32 AM
I know this thread is old but the GlideSysAttachment.copy function is very good, you just have to be careful how you use it.
If you loop through the records on the sys_attachment table this can cause issues of duplicate attachments on the target record as the loop can encounter the same source record twice.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-11-2022 06:54 AM
I have an issue related attachments, we have a table 'core_company' and there are 3 different tables in related list of that table, they are 'vendor risk assessment' , 'IRQ Assessment' , 'vendor engagement'.
when we attach any attachment in any of the table, then it should get attached in to 'core_company' table,
can we do it from business rule or is there any other method for that.
Hoping a reply is given for this query.
Thank you.