copy attachments from incident to knowledge
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2024 01:36 AM - edited 05-14-2024 02:15 AM
Hi,
Created a knowledge article from an incident is resolved. (without plugin)
But we also want to copy attachments too.
I wrote a BR, but it is not working. Could you please help me with this ?
Thanks
@Amit Gujarathi @SANDEEP28 @Community Alums @Arpan Baishya @Mark Anderson @Mark Ma @Kieran Anson
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2024 02:12 AM - edited 05-14-2024 02:13 AM
Hello @Thej1 ,
Please add below code.
var scTask = new GlideRecord('sc_task'); // Add your table name
scTask.addQuery('sys_id', current.sys_id);
scTask.query();
gs.info('Sctask Count before insert br:' + scTask.getRowCount());
if (scTask.next()) {
GlideSysAttachment.copy('sc_req_item', scTask.request_item.sys_id, 'sc_task', scTask.sys_id); // Change the table name and record sys_id as per your requirment
}
Please Mark my Solution as Accept and Give me thumbs up, if you find it Helpful.
Regards,
Vaishnavi Shinde

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2024 03:47 AM - edited 05-14-2024 05:11 AM
Hi @Thej1,
Consider using Flow Designer in this regard. You can define a record-based trigger with the necessary table name and conditions. Then, you may use Attachment-related actions such as Get Attachments on Record (getting the count and list of attachments) and Copy Attachment (place this action inside a For Each loop) in order to copy attachments from Incident to Knowledge.
Let me know if this helps.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2024 05:14 AM
Agreed, this is the most maintainable approach. Below Flow is an example and took less than 5 minutes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2024 04:39 AM
Hi @Kieran Anson ,
In the 5th step, i kept source attachment record as like this.
It is throwing an error in the execution as
Could you help me with this ?
Thanks