Earlier a print context could be renamed to something I wanted when running “Create Email Content” in workflow. I just added: “merge.template.contexts.PRINT.sections[record.fields[‘{sectionname}’]].part = ‘My attached file name’;” in a script in the designer.
Since version 2021, it’s not longer possible. Instead I get the subject name of the email as the name for the attached file? why? And how can I change the name now?
Can you let us know please if record.fields['{sectionname}'] returns a value which corresponds to a existing Print Context Section Name?
I’m asking you this question because I would expect that the following JavaScript code should still be working in version 2021.x of PReS Connect or PlanetPress Connect:
It has been fully functional and working very well from 2017 (version 8? I guess) and then through some updates, I guess 2018, 2019 versions of PlanetPress Connect, and then it stopped working in 2021.2.1.8220 when I Updated. I am not sure that I ever had version 2020 so I don’t know about that version.
Previous code makes sure that only one of these three sections is enabled at any time.
So, I should get one attachment and it should be named Factuur, Facture or Invoice.
However, the attachment name I get, is _PlanetPress_ snippets_Email Templates_Invoice_Open.html.pdf which is the path and name of the snippet that gets loaded as the body of the email.
My version of the Designer is 2021.1.1.6675
Until I get this right, I’m using the “File > Send test email” functionality.
Was Kalle’s problem ever solved?
As a side node…
This line suggested in previous mentionned documentation
if (channel === Channel.EMAIL) {
gives me an error "channel" is not defined. Any ideas how to solve that?
According to the code you posted you’re trying to change the name of the Print context attachment; a PDF. But you also said:
the attachment name I get, is _PlanetPress_ snippets_Email Templates_Invoice_Open.html
This is confusing to me, because the name of a Print context attachment always ends in “.pdf”. The extension is static and cannot be changed. Are you sure you’re looking at the right attachment?
About the (channel === Channel.EMAIL) line, that should be (merge.channel === Channel.EMAIL).