Highlighted
Super Contributor.
Super Contributor.
242 views

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?

0 Likes
4 Replies
Highlighted
Honored Contributor.. Honored Contributor..
Honored Contributor..

Betreff: Attachments into an HTML template

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 🤖

0 Likes
Highlighted
Super Contributor.
Super Contributor.

Betreff: Attachments into an HTML template

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

Changes to the Master or Rule?

0 Likes
Highlighted
Honored Contributor.. Honored Contributor..
Honored Contributor..

Betreff: Attachments into an HTML template

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

 

0 Likes
Highlighted
Super Contributor.
Super Contributor.

Betreff: Attachments into an HTML template

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

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.