2022.2

Table Of Contents
Function Description
addAfter()
Addaclonedsectionafterthissection.
addBefore()
Addaclonedsectionbeforethissection.
addHeader(key,
value)
Email sections only.Usedtosetcustomemailheaders.Thefunctionexpectsakeyandavalue(bothoftypestring).For
examples,see"AddingcustomESPhandlinginstructions"onpage1345.
"html()"on
page1291
SetstheinitialHTMLofthebodyelement.
"paginate()"on
page1312
Post Pagination Scripts only.PaginatesthecontentofaPrintsection.
Examples
Conditionally skipping or printing Print sections
ThisscriptdisablesallPrintsectionsandthenre-enablesoneofthem,dependingonavalueinthecur-
rentrecord.
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
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;
}
Page 1283