- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2023 06:54 AM
Hello Experts,
We have received a requirement from client , we want the attachment added by task handler on sc_task table should get copied on another task so that concerned team can download the attachment added and do the needful
How can we achieve this?
All suggestions are welcome here,
Thank you,
Ujjwala
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2023 07:07 AM - edited 03-23-2023 07:09 AM
Refer this sample code:Create before insert business rule
var task = new GlideRecord('sc_task');
task.addQuery('request_item',current.request_item);//check proper names for Ritm reference field on sc_task record
task.query();
if(task.next()){
- GlideSysAttachment.copy('sc_task', current.sys_id, 'sc_task',task.sys_id);
}
Thanks and regards,
Manjusha .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2023 07:02 AM
Yes you can,
in the sys_attachment table you need to find the table (sc_task in your case) and the sys_id of the record the attachment is attached.
Then you need to create new record with your new table and new sys_id - basically copy the previous record and insert new one with these 2 things changed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2023 07:07 AM - edited 03-23-2023 07:09 AM
Refer this sample code:Create before insert business rule
var task = new GlideRecord('sc_task');
task.addQuery('request_item',current.request_item);//check proper names for Ritm reference field on sc_task record
task.query();
if(task.next()){
- GlideSysAttachment.copy('sc_task', current.sys_id, 'sc_task',task.sys_id);
}
Thanks and regards,
Manjusha .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2023 07:13 AM
Hi,
Thanks for replying
On which table I should write this BR?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2023 07:15 AM - edited 03-23-2023 07:17 AM
The table on which you are creating the task -sc_task(i thought you are using sc_task so i written code as per that )
Thanks,
Manjusha Bangale