I know it is possible to dynamically add one attachment to an email using the hyperlink method. I’ve tried using this method to add more than one attachement (attachment path is in a detail record) by looping through the attachments and adding multiple href lines to the #head. But this does not seem to work. Any ideas on achieving this?
Not sure what your script looks like but try the below
- Add a script to the scripts pane
- Set the selector to html.HTML_EMAIL[section=“Content”] > head
let attachments ="";
let attachmentsPath = "file:///C:/Test/Attachments/";
let attachmentsCount = record.tables.detail.length;
for(let i = 0; i< attachmentsCount; i++){
let pdfname = record.tables.detail[i].fields["pdfname"];
if(pdfname){
attachments += '<link href="' + attachmentsPath + pdfname + '" title="' + pdfname + '" rel="related">';
//logger.info(attachments);
}
}
results.append(attachments);
The script basically is the same as yours, the only difference is the selector I’m using. As per example the selector I am using is head, the selector you are suggesting is somewhat more specific, but certainly worth a shot.
I’ll try this and report back.
Thanks.