2020.2

Table Of Contents
Function Description
"query
(selector)"
on page927
Runs a query across all sections in the Print context. This function is only
available in Post Pagination Scripts, which are only applied to the Print
context. See "Post Pagination Scripts" on page433.
Example
This script checks if the output channel is EMAIL and if the context to be merged is the Print
context (which happens if the Print context is attached to an email). If this is the case, it includes
and excludes certain Print sections from the output.
if (channel == Channel.EMAIL) {
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;
}
}
masterpage
The masterpage object is used to set a Master Page's header and footer or to replace its entire
HTML body. It can only be accessed in Control Scripts (see "Control Scripts" on page417 and
"Control Script API" on page889). Trying to access it in another type of script will result in an
error.
Note that Master Pages are only used in a Print context (see "Master Pages" on page153).
In script, Master Pages are retrieved via the masterpages Array which contains all Master
Pages in the current template (see "template" on page917).
For example: var myMasterpage = merge.template.masterpages["Master page 1"];.
Functions and fields
Field Type Description
"html()" on
page916
Gets or sets the HTML of the body element.
"margins" on Margins Allows to set the header and footer of a Master Page, using a
Page 892