- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-08-2020 07:36 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-08-2020 07:40 AM
Hi Praveen,
I assume you want attachment to be copied over from SC Task to RITM when attachment is added
sample BR on sys_attachment; It would be copying all attachments to RITM from SC TASK
BR: after insert on sys_attachment
Condition: current.table_name == 'sc_task'
Script:
var taskRec = new GlideRecord('sc_task');
taskRec.addQuery('sys_id', current.table_sys_id);
taskRec.query();
if(taskRec.next()){
var ritmRec = new GlideRecord('sc_req_item');
ritmRec.addQuery('sys_id',taskRec.request_item);
ritmRec.query();
if(ritmRec.next()){
GlideSysAttachment.copy('sc_task', current.table_sys_id, 'sc_req_item', ritmRec.sys_id);
}
}
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-31-2021 04:38 PM
Hi
I have used similar code to copy attachments from SC Task to RITM table but the problem is the attachments in the sc task are from "Attachment" variable.
So, instead of
GlideSysAttachment.copy('sc_task', current.table_sys_id, 'sc_req_item', ritmRec.sys_id);
I have used
GlideSysAttachment.copy('ZZ_YYsc_task', current.table_sys_id, 'sc_req_item', ritmRec.sys_id);
Now, attachment is getting copied from sc task to activity stream of RITM but not to the paperclip icon on the header. I want that to be attached to paperclip on the RITM table. Do you have any suggestions on this?
Also, I don't see the attachment variable on the sc task once the task is closed complete, it would be good to have it on the task even it's closed.
FYI - we are currently on Paris version and the catalog item is in a scoped application.
Thanks,
Kat
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-24-2025 07:07 AM
hi Ankur,
what is the table in the BR configuration? and what is the filter condition? thanks!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-24-2025 07:13 AM
can you post a new question for this and tag me there and share all the details as this is an old thread?
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-19-2025 04:37 AM
Hi!
This BR works well, but as you said, it would be copying all attachments from the SC Task to the RITM. So, if I add multiple ones, there are going to be duplicate attachments on the RITM.
Is there a way to copy only the newly added attachment, or do I have to create another BR to remove duplicate attachments?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-19-2025 05:53 AM
Can you post a new question with all the details and tag me there as this is an old thread?
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
