- 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 || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- 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 || ✨ 9x 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 || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-20-2025 01:49 AM - edited ‎08-20-2025 01:50 AM
The problem I'm having is that all attachments are copied from the SCTASK to the RITM. This means that every time I add something to the SCTASK, duplicates are created on the RITM.
If I add document 1 to the SCTASK, I get document 1 on the RITM. Now, if I add document 2 to the same SCTASK, I get document 1 twice and document 2 on the RITM.
I have a rule that prevents duplicates, but it's based on the 'table_sys_id'/'table_name'/'file_name'/'content_type'/'size_bytes' fields, which isn't perfect.
I'd like to copy only the newly added attachment to avoid any duplicates from the start. Do you know of a way to do this?