Adding attachments to Email
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-08-2024 08:07 AM
We want to send attachment available in sctask1 through email .The email gets trigger after closure of sctask 6. We wrote the business rule at certain condition but it is not working . can anyone please help me how to get this ?
(function executeRule(current, previous /*null when async*/ ) {
// var ins = current.instance;
var at = new GlideRecord("sc_task");
at.addQuery('short_description', 'STARTSWITH', 'Attach Signed Lease');
at.query();
while(at.next()){
var syid= at.getUniqueValue();
}
var gr = new GlideRecord("sc_task");
var ins = gr.get(current.instance);
if (ins) {
var grSysAtt = new GlideRecord('sys_attachment');
grSysAtt.addQuery("table_sys_id", syid);
grSysAtt.query();
while (grSysAtt.next()) {
var content = new GlideSysAttachment().getContentStream(ins.sys_id);
new GlideSysAttachment().writeContentStream(current, grSysAtt.getValue('file_name'), grSysAtt.getValue('content_type'), content);
}
}
})(current, previous);
5 REPLIES 5
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Thanks a lot