2021.1

Table Of Contents
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1031.
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.
The following script (with the selector p) changes the text color of all paragraphs to red with a
single line of code:
results.css('color', 'red')
It does this for each and every customer, because it does not depend on a value from the record
that is being merged to the template.
Using values from the record in a script
To access the record that is being merged to the template when the script runs, use the object
record.
Suppose you want to display negative amounts in red and positive amounts in green.
Assuming that there is an AMOUNT field in your customer data, you could write the following
script (with the selector: td.amount, that is: table cells with the class 'amount').
Page 872