Attachment to from RITM to SCTASK
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2023 12:38 PM
I have created a Business Rule to copy attachments from the RITM to the SCTASK with the following script:
var gr = new GlideRecord("sc_task");
gr.addQuery("request_item", current.sys_id);
gr.query();
while(gr.next()) {
GlideSysAttachment.copy('sc_req_item', current.request_item, 'sc_task', gr.sys_id);
}
And it does not seem to be working. Any help would be greatly appreciated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2023 01:07 PM
Hi,
Try this.
(function executeRule(current, previous /*null when async*/) {
// Add your code here
if (current.hasAttachments())
{
var gr = new GlideRecord('sc_task');
gr.addQuery('request_item',current.sys_id);
gr.query();
while (gr.next())
{
var a = new GlideSysAttachment();
a.copy('sc_req_item',current.sys_id,'sc_task',gr.sys_id);
}
}
})(current, previous);
If you found my response helpful or relevant to your query, please consider clicking the "Helpful" button or giving it a "Like". This not only helps others identify useful replies but also encourages contributors like me to continue assisting the community. Thank you for your support!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-15-2024 08:35 AM
is the BR on insert? update?
after or Before?