Copy attachment
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hello All ,
In a RITM , i have a field where i attached a file (XLS) ...
Could you please show me how i can copy this file to another table ?
I have tried this , but the file is attached in the activity , not in the attachment doc .
var attachmentGR = new GlideRecord('sys_attachment');
attachmentGR.addQuery('table_sys_id', ritmSysId);
attachmentGR.query();
if (attachmentGR.next()) {
var sa = new GlideSysAttachment();
sa.copy('sys_attachment', ritmSysId, sys_class_name , ciLDZ );
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
If your source attachment is in RITM table then your source table should be sc_req_item instead of sys_attachment table.
var sa = GlideSysAttachment()
sa.copy(String sourceTable, String sourceID, String targetTable, String targetID)
Please refer this
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Your cord should be :
var sa = GlideSysAttachment()
sa.copy('sc_req_item', sys_id of RITM, String targetTable, sys_id of target record)
I hope this help. Please mark it helpful/correct if it resolve your query.
Regards,
Amitra
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @KouassiP
You can refer this video to implement your requirements below:
https://youtu.be/HZ1u2HWmORs?si=_P-DeKQTeuOem8K5
Please appreciate the efforts of community contributors by marking the appropriate response as the correct answer and helpful. This may help other community users to follow the correct solution in the future.
********************************************************************************************************
Cheers,
Prashant Kumar
ServiceNow Technical Architect
Community Profile LinkedIn YouTube Medium TopMate
********************************************************************************************************