- 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 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 12:29 AM
Hi,
you can also use flow designer with no script to copy all the attachments from current problem to related incidents
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 12:47 AM
Hey Ankur,
Thanks for reply,
i have seen most of BR script designed on "sys_aathcment" table.
i didn't understand one thing
1 . At which point we have to write BR on "Sys_attachment " table to copy attachments from Parent to Child ?
2. At which point we have to write BR on "Parent" table to copy attachments from Parent to Child ?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-14-2021 01:09 AM
Hello,
As mentioned by Ankur, the BR should run on "problem" table, WHEN your checkbox is made TRUE.
Then run the script provided inside that business rule