Attachments into an HTML template

Hi!
We need to attach the attachments from the interaction into HTML notification for the operator. But I can't find this function or method. Maybe I'm looking in the wrong place, or it's impossible.

Could you help me, please?

  • Hi Artem,

    I'm afraid the standard HTML notification rule doesn't support attachments. Maybe I'm not up to date because I had the problem 2 years ago!

    I had to write my own SL for this. This is a snippet I found on my disk (not testet!!!):

    var fMail = new SCFile('mail'); fMail['mailno'] = lib.MailUtil.newMailno(); fMail['user.to'] = _aRecipientMails.join(','); fMail['user.from'] = system.functions.operator(); fMail['date.to.send'] = system.functions.tod(); fMail['status'] = 'sent'; fMail['subject'] = lib.htmlemailtemplates.getMailHeader(htmltemplatename, record, record, _aRecipientMails[0], htmltemplatelanguage); fMail['application'] = 'email'; fMail['text'].push(lib.htmlemailtemplates.getMailBody(htmltemplatename, record, record, _aRecipientMails[0], htmltemplatelanguage, true);); fMail['user.array'] = _aRecipientMails; fMail['ccuser.array'] = null; fMail['bccuser.array'] = null; var attachment = new Attachment(); attachment.name = sAttachmentFileName; attachment.type = sAttachmentDataType || 'text/plain'; attachment.value = data; var attachmentID = fMail.insertAttachment(attachment); var parameters = { 'record' : fMail }; lib.c.$.callrad('axces.email', parameters);

     

    Hope this helps as a starting point...

    Bo

  • Thanks for the tip, but where did you write this?

    Changes to the Master or Rule?

  • Hi Artem,

    we created a RuleSet in the Incident Workflow with a Javascript Validation Rule. In the rule we called the ScriptLibrary function with the current record and the htmltemplate name as parameters.

    That's all!

    Bo

     

  • Hi, what is _aRecipientMails?
    I create a set of rules according to your example, and I get an error

    ReferenceError: _aRecipientMails is not defined Could not process script.


    I tried to execute it simply in the script, but also saw this error.
    help me, please

  • Hi,

     

    Did you ever get this implemented? What version of SM9 are you using for this?