- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
on ‎08-05-2022 07:55 AM
I have explained how to Copy Attachments from one table to another using Business Rules.
If you have any feedback related to the scripting part, please write it in the comment box.
====================BUSINESS RULES======================
Table - Requested Item
When to Run - Before Update
Condition - Send Attachments to True
Scripts -
(function executeRule(current, previous /*null when async*/ ) {
// Add your code here
var copy = new GlideRecord('problem');
copy.addQuery('parent', current.getUniqueValue());
copy.query();
if (copy.next()) {
GlideSysAttachment.copy('incident', current.getUniqueValue(), 'problem', copy.getUniqueValue());
}
})(current, previous);
Best Regards,
Prashant
If my article helped you in any way, please mark this as helpful and make this a bookmark.
- 4,179 Views
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
very useful content
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hi @PrashantLearnIT ,
Does the above script copy all the attachments at once?
What if I want to copy the attachment added via the record producer variable from the 'sys_attachment' table to any custom table?
Thanks,
Amol
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hi Amol,
It is copying one for now.
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hi Prasant , thank for this great article.
However if I may ask , if it is possible to copy an email from one table to another.
For example . an reply email was sent to an interaction and a case is being created from the email (Via flow)and the new case should have the Inbound reply email in the email related list.
Thanks in advance for your reply.
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
I’ve implemented the same functionality using Flow Designer, which moves uploaded attachments between the Case and Incident tables one by one. This approach allows me to control the process and avoid duplicate attachments