Copy attachment from sys_attachment
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-07-2016 02:34 AM
Hello,
I have a lot attachment on sys_attachment that I would copy on different KB Articles.
I made an On after script on my Transform who import the articles. But it doesn't work.
When I tried between two articles from kb_knowledge, it's works fine.
Do you have any ideas ? I already copy from sys_attachment to another table, but this time, it doesn't works..
Thanks
// log.info("source.u_attachment = " + source.u_attachment);
// GlideSysAttachment.copy('sourcetable', 'sys_id', 'destinationtable', 'sys_id');
var sysAttachment = new GlideRecord('sys_attachment');
sysAttachment.addQuery('file_name',source.u_attachment);
sysAttachment.query();
if(sysAttachment.next()){
log.info("copy attachment " + sysAttachment.sys_id + " on knowledge article " + target.number + " - " + target.sys_id);
GlideSysAttachment.copy('sys_attachment', sysAttachment.sys_id, 'kb_knowledge', target.sys_id);
}
target.update();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-07-2016 08:13 AM
GlideSysAttachment.copy() copies all attachments from one source record to another. Therefore if sys_attachment is your source record, you are trying to copy "attachements on an sys_attachment" record ... which I doubt has any. Your source table needs to be a record that HAS attachments.
-Ken

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-07-2016 08:32 AM
Hi Didier,
Please refer below thread. Looks to be an issue.