- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2021 12:24 AM
Hi All,
Kindly Suggest me solution to copy attahments. from Problem--> Incident
on Problem form we have one Check-box which names call it as "Copy Attachments " ,
it will be visible only when State | Root cause analysis .
if we make TRUE that check box, update the record , then copy all attachments from PROBLEM--> related INCIDENTS
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2021 12:28 AM
Hi,
you can use after update BR on problem table
Condition: Checkbox Field [Changes To] True
Script:
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var gr = new GlideRecord("incident");
gr.addQuery("problem_id", current.sys_id);
gr.query();
while(gr.next()) {
new GlideSysAttachment.copy("problem", current.sys_id, "incident", gr.sys_id);
}
})(current, previous);
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2021 01:41 AM
Hi,
I agree with Paul here.
Not to duplicate the attachments on multiple table as it would consume more storage
alternative is to show related list
check this link for approach
Related Attachments" Related List
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2021 01:42 AM
Hi,
BR on sys_attachment is usually written to copy attachment as soon as it is added on some table and then you need to copy to another record
BR on parent table is required when some update would happen and then you want attachment to be copied over
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2021 01:12 AM
I don't think it is good practice to make copies of attachments across multiple records.
Consider instead creating Relationships that show attachments on records with relationships to the problem, or even a display BR that prompts the user that related records have attachments.
ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022