copy attachments from request to RITM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-24-2016 11:46 PM
Hi,
I have a requirement to copy all the attachments from Request to the corresponding RITMs.
I have written an After-Insert Business rule on the Request table to achieve the same. But it seems the code is not working as expected.
Name: Copy Attachments to RITM
Table: Request (sc_request)
When to run: After - Insert
Script:
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var ritm = new GlideRecord('sc_req_item');
ritm.addQuery('request', current.sys_id);
ritm.query();
while(ritm.next())
{
GlideSysAttachment.copy('sc_request', current.sys_id, 'sc_req_item', ritm.sys_id);
}
})(current, previous);
Any lead will be appreciated. Thanks in advance!!