2021.2

Table Of Contents
Warning
When you change an expanded text script and save it, it becomes impossible to
edit the script using the Script Wizard again.
2. Write the script. Click Apply from time to time to see if the script works as expected. This
will be visible on the Preview tab in the main workspace.
Syntax rules
Every script in the Designer must follow JavaScript syntax rules. For example, each statement
should end with ; and the keywords that can be used, such as var to declare a variable, are
JavaScript keywords. There are countless tutorials available on the Internet to familiarize
yourself with the JavaScript syntax.
For a simple script all that you need to know can be found on the following web pages:
https://www.w3schools.com/js/js_syntax.asp and https://www.w3schools.com/js/js_if_else.asp.
A few examples can be found in a How-to: Combining record based conditions.
Tip
In the editor window, press Ctrl + Space to see the available features and their
descriptions.
Use the arrow keys to select a function or object and press Enter to insert it in the script.
Type a dot after the name of the function or object and press Ctrl + space again to see
which features are subsequently available.
For more keyboard shortcuts, see "Keyboard shortcuts" on page1041.
Two basic code examples
Writing a script generally comes down to modifying the piece(s) of content collected from the
template with the script's selector, using values, or depending on values of the record that is
being merged to the template at the moment the script runs.
Modifying the template
To access and change the results of the query that is carried out with the selector (in other
words: to modify the output), use the object results.
Page 881