Carry Over Attachment from Task to Task.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-10-2023 03:11 AM
Hi All.
I have a requirement where attachment needs to carry over from task to task.
usually in task 1 client will upload the attachment, that should carry over to next task and also present in RITM.
A quick would really appeciate it.
Thank you

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-10-2023 03:23 AM
@prash4 Write a onBefore Update business rule on your sc_task table as follows.
Here is the script.
(function executeRule(current, previous /*null when async*/ ) {
// Add your code here
var glideTask = new GlideRecord('sc_task');
glideTask.addQuery('parent', current.parent.getValue('sys_id'));
glideTask.addQuery('short_description', '<short description of your other task>');//Put short description of the taks where you would like to copy the attachments
glideTask.query();
while (glideTask.next()) {
var attachment = new GlideSysAttachment();
var copiedAttachments = attachment.copy('sc_task', current.sys_id, 'sc_task', glideTask.getValue('sys_id'));
gs.info('Copied attachments: ' + copiedAttachments);
}
})(current, previous);
Hope this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-10-2023 03:26 AM
Why to copy same file in multiple records?
This will increase size of sys_attachment table
Why not use this related list custom functionality?
TNT: "Related Attachments" Related List
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader