- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-09-2022 09:06 PM
Hi
We have requirement to copy attachment from sc_req_item to change_request.
When user submits request with any attachment that attachment should get copied to related change request.
How can we achieve that?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-09-2022 10:31 PM
Hi,
then use after insert BR on change_request table
Condition: current.parent.sys_class_name == 'sc_req_item' && current.parent != ''
Script:
GlideSysAttachment.copy('sc_req_item', current.parent, 'change_request', current.getUniqueValue());
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
‎02-09-2022 09:15 PM
HI
Follow this link, Perfectly works...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-09-2022 09:26 PM
Hi,
how are you creating CHG?
are you using workflow run script for this?
if yes then you can use this script to copy file
var rec = new GlideRecord('change_request');
rec.initialize();
// set your fields here
rec.description = 'your value';
rec.insert();
GlideSysAttachment.copy('sc_req_item', current.getUniqueValue(), 'change_request', rec.getUniqueValue());
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
‎02-09-2022 09:38 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-09-2022 10:31 PM
Hi,
then use after insert BR on change_request table
Condition: current.parent.sys_class_name == 'sc_req_item' && current.parent != ''
Script:
GlideSysAttachment.copy('sc_req_item', current.parent, 'change_request', current.getUniqueValue());
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader