2022.1

Table Of Contents
Examples
Conditionally skipping or printing Print sections
This script disables all Print sections and then re-enables one of them, depending on a value in
the current record.
var printSections = merge.template.contexts.PRINT.sections;
printSections['Section EN'].enabled = false;
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
This script selects a different Print section for output, depending on the output channel (Email or
Print).
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
This script renames the file name of an attachment by setting the part name of a section (see
"Parts: splitting and renaming email attachments" on page961).
var section = merge.template.contexts.PRINT.sections['Section 1'];
section.part = 'Invoice ' + record.fields['InvoiceNo'];
Controlling multiple Email attachments
The following script attaches the following sections to an email:
Page 1484