2022.2

Table Of Contents
printSections['Section FR'].enabled = false;
if(record.fields.Language === 'FR'){
printSections['Section FR'].enabled = true;
} else {
printSections['Section EN'].enabled = true;
}
Selecting different sections for Print output and Email PDF attachment
ThisscriptselectsadifferentPrintsectionforoutput,dependingontheoutputchannel(EmailorPrint).
var printSections = merge.template.contexts.PRINT.sections;
if(merge.channel === Channel.EMAIL){
printSections['Section 1'].enabled = false;
printSections['Section 2'].enabled = true;
}
if(merge.channel === Channel.PRINT){
printSections['Section 1'].enabled = true;
printSections['Section 2'].enabled = false;
}
Setting the name of Email PDF attachments
Thisscriptrenamesthefilenameofanattachmentbysettingthepartnameofasection(see"Parts:
splittingandrenamingemailattachments"onpage843).
var section = merge.template.contexts.PRINT.sections['Section 1'];
section.part = 'Invoice ' + record.fields['InvoiceNo'];
Controlling multiple Email attachments
Thefollowingscriptattachesthefollowingsectionstoanemail:
l
Printsection3+4asattachmentwithcontinuedpagenumbers
l
Printsection6asseparateattachment(alsosee"Parts:splittingandrenamingemailattach-
ments"onpage843)
l
WebsectionsAandBasseparateattachment
if (channel == Channel.EMAIL) { // only when generating Email output
if (merge.context.type == ContextType.PRINT) {
merge.context.sections['Section 1'].enabled = false;
merge.context.sections['Section 2'].enabled = false;
merge.context.sections['Section 3'].enabled = true;
merge.context.sections['Section 3'].part = "PDFAttach1";
Page 1309