2021.2

Table Of Contents
Writing your own scripts
Personalization can be taken a lot further than just inserting names and addresses, and hiding
or showing text or images. Every bit of information in your communications can be made
entirely personal, using scripts.
A script is a small set of instructions to the program, written in JavaScript.
When Connect generates the actual output letters, web pages or emails -, it opens a record
set and merges it with the template. It takes each record, one by one, and runs all scripts for it
(in a specific order, see "The script flow: when scripts run" on page897).
Any kind of personalization is done via scripts, but you don't have to write every script yourself.
In many situations you can use a Script Wizard, which will do that for you (see "Personalizing
content" on page789).
For a block of variable data, such as an address, the Text Script Wizard is a perfect fit.
Paragraphs can be made conditional with a Conditional Script Wizard.
For dynamic images, you can use the Dynamic Image Script Wizard.
In an Email context, you are provided with a number of Email Script Wizards to set the sender,
the recipients and the subject of the email.
However, when you want to do something that goes beyond what you can do with a Wizard,
like creating a conditional paragraph with a condition that is based on a combination of data
fields, you have to write the script yourself.
This topic explains how scripts work and how you can create and write a script yourself.
Script types
There are three types of scripts in the Designer: Control Scripts, Standard Scripts and Post
Pagination Scripts.
Control Scripts
When output is generated from a template, Control Scripts run before all other scripts, when a
record is merged with a context. They determine how different sections of the context are
handled. They can, for example, make the page numbering continue over all Print sections,
split Email attachments, or omit Print sections from the output.
Page 877