Runtime parameters
Runtime parameters can pass values from an automation tool - OL Connect Workflow, usually - to a template, data mapping configuration or Job Preset. The actual values of the parameters may be different from one time that a process runs to the next, which means the output could be different even when the same template, data mapping configuration and/or Job Presets are used.
Defining runtime parameters for a template
Runtime parameters in a template must be defined on the Parameters pane. This can be found next to the Data Model pane. If it isn't visible, use the menu: Window > Show View > Parameters to make it visible.
Note: The variable that contains the value of a runtime parameter must be selected in OL Connect Workflow, in the Runtime Parameters section of the OL Connect task that uses the template: the All In One, Create Print Content, Create Email Content, Create Web Content, or Create Preview PDF task. For more information see OL Connect tasks.
To add a parameter, start by opening the template to which the parameter should be added. Make sure the template is visible in the workspace; then open the Parameters pane.
Note: Runtime parameters are always added to the file currently visible in the workspace.
To add a single parameter:
-
Click the Add button ( ).
-
Give the parameter a name.
-
Select the data type. This impacts the way the data can be handled in a script; for example, if a parameter's type is Number, its value can be used directly in calculations, without having to parse it first.
In the Parameters pane, the type of a runtime parameter can be recognized by its icon. -
Optionally, set a default value. A default value will only be used in the case that there is no actual value coming from the automation tool, e.g. one of the Content Creation tasks in OL Connect Workflow, at runtime. Since runtime parameters cannot be empty, this prevents an error.
At design-time runtime parameters are undefined, unless you add values manually in order to test a template. For instructions, see below. -
Click OK.
To add multiple parameters or to set values:
-
Click the Set Values button (). This opens the Set Values dialog which allows to load JSON data.
Any previously defined runtime parameters are displayed in the dialog as a JSON object. Parameter names appear as keys; default values appear as values. -
Either browse to the location of a JSON file and select it, or paste/write/edit the JSON directly in the box below the File field.
Note that JSON arrays are not supported. -
Click OK. The keys of the JSON object appear in the Name column, the values in the Value column.
-
For new parameters an attempt is made to derive the data type from the value, but this is only possible to a limited extent. Double-click any new parameter to set its desired data type.
Editing a runtime parameter
To edit a runtime parameter, either:
-
Double-click the parameter; or right-click and choose Edit; or select the parameter and click the Edit button (), and modify it in the Edit Parameter dialog.
-
Click the Set Values button () and edit the JSON. Note that this method cannot be used to change the name of a runtime parameter. You can only change the values and add new runtime parameters this way.
If the Data Model contains a JSON Record Data List (see A JSON Record Data List), you could edit the runtime parameters by adding or editing the parameters
object using the JSON sample data dialog.
Accessing runtime parameters
Runtime parameters in a template are accessible in scripts, via merge.template.parameters
. (See Standard Script API.)
The merge.template
object has a parameters
array that allows to access the template's runtime parameters. (See: template.) The script can read and could also change the values. Note however that any runtime parameter's value will be reset with each new record that the template is being merged with.