copy or create attachment via script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
31m ago
Hi,
I have multiple attachment on specific records. I want using a business rule to copy only specific one of them to a different record so that this attachment will be on the target record but he will also still be on the source record together with the other attachments on the source records. How can I achieve that?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
13m ago
ahoy @Alon Grod,
could you possibly explain what do you mean "specific records"? it might vary from Task to Incident or from Knowledge Article to a Story...
Also, share your business rule/script for a review, this description is too abstract to help you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
7m ago
I have multiple pdfs files on the source record(case record on slm_case table)
I want to copy only of them to a new sn_slm_case record
(function executeRule(current, previous /*null when async*/ ) {
if (current.u_supplier_local == 'ארץ') {
var gr = new GlideRecord('sys_attachment');
if (gr.get('744fc71f9fb8d71023126dd81224abae')) {
var attachment = new Attachment();
attachment.write(
current.getTableName(), // table of the record you attach to
current.getUniqueValue(), // sys_id of the record you attach to
gr.getValue('file_name'),
gr.getValue('content_type'),
GlideSysAttachment.getBytes(gr) // file content
);
}
}
})(current, previous);