Configuring variable output filenames in OL Connect Automate
This tutorial will guide you through setting up job and output presets in OL Automate to generate dynamic filenames using flow variables.
What you will learn:
- Passing the a flow variable to a Job Preset using a Runtime Parameter.
- Configuring the Job Preset to include both the variable from the flow and a field from the input data file as document metadata.
- Setting up an Output Preset to create separate output files for each document and use the timestamp and customer number in the filename.
The recipe
Generating the timestamp
First, add a Change node to your flow and create a msg.batch property. In our example, we’ll use a JSONata expression to produce a formatted timestamp, but you can also include other details from the flow, such as a segment of the job data file name. JSONata is a powerful query and transformation language for JSON data, offering various functions, including date formatting.

$moment().format("YYYYMMDD_hhmmss")
This stores the formatted timestamp in msg.batch. To verify its value, add a Debug node, set its output to msg.batch, and check the Debug panel for the result.

OL Connect resources
This tutorial utilizes a Data Mapper configuration for XML data, a simple business letter template, a Job Preset to add metadata to documents, and an Output Preset to generate PDF output.
Configuring the Job Preset
The Job Preset plays a crucial role in storing metadata with each document. Metadata can be derived from the input data, set as static information, or passed dynamically from the automation tool using a runtime parameter. This metadata is can than be utilized in the Output Preset to generate variable filenames.
- Open the Job Preset configuration and select the corresponding Data Mapping configuration, which provides access to the data fields of the input data.
- Navigate to the Runtime Parameters page and create a parameter named
batch. - On the Metadata Options page, add the following document-level metadata tags:
- customerNumber (from the input data)
- batch (runtime parameter)

This metadata is now available for filename formatting within the Output Preset.
Setting up the Output Preset
To configure dynamic output filenames in the Output Preset:
- Open or create an Output Preset and link it to the previously created Job Preset.
- Enable Separation to generate individual output files per document.
- On the Print Options page, set the Output Type to Directory.
- Define a Job Output Mask using the metadata variables:
${document.metadata.batch}_${document.metadata.customerNumber}.pdf
This dynamically generates filenames using the batch timestamp and customer number.
Note! The Job Output Folder can be set in the preset, but can be overridden from within the All In One or Paginated Output nodes.
Populating the Runtime Parameter
Open the flow in the flow editor. To set the batch parameter needed for the Output Preset:
- Insert or edit the All In One Node.
- Select the required OL Connect resources.
- Add the batch runtime parameter and assign
msg.batchto it.

Instead of using a Change node, you can assign the parameter directly using JSONata:

This eliminates the need for an additional Change node, simplifying the flow.
Conclusion
By following these steps, you can effectively configure dynamic filenames and output paths in OL Connect Automate. Here are the key takeaways:
- Use JSONata expressions to generate timestamps dynamically.
- Configure Job Presets to store runtime parameters as metadata.
- Reference metadata in Output Presets to format filenames.