Render Email Content
The Render Email Content task pre-renders emails from a template's Email Context and stores them in the File Store, along with their attachments.
Note: The Render Email Content task works only if OL Connect is licensed for sending emails. It is not available for users with Demo, Test or Reseller licenses.
For the Render Email Content task in OL Connect Workflow 2020.1 and higher to function correctly with the SendGrid and Mailjet plugins, the version 2020.1 or higher of those plugins is required. They are available for download on the Resource Center (https://olresourcecenter.uplandsoftware.com). .
Input
This task must receive either Metadata containing information regarding a valid Record Set, or JSON data.
Metadata
The Execute Data Mapping task and the Retrieve Items task output Metadata containing information regarding a Record Set.
Note: The plugin takes the entire Metadata file as its input, even when it is placed after a Metadata Sequencer task.
JSON
The Render Email Content task supports two types of JSON:
- A JSON object or an array of JSON objects representing records. If a value in a record object is a string, it is considered to be a field value. If a value in a record object is a JSON object, it is considered to be a nested table with detail records. For examples, see JSON string examples.
- A JSON Record Data List (see the REST API Cookbook and JSON Record Data List example). When the Execute Data Mapping or Retrieve Items task is set to output Records in JSON, it outputs this kind of JSON data.
If the input is JSON, the task performs a REST call to the /rest/serverengine/workflow/contentcreation/email/{templateId} endpoint on the Connect Server. For more information see the REST API Cookbook.
The Render Email Content task expects UTF-8 encoded JSON job data files.
Note: Make sure that other components in the Workflow configuration working on the job data handle UTF-8 encoded files correctly.
Processing
This task loops through each record in a Record Set or through each JSON object in an array. For each record or JSON object, the task generates an HTML email using that record's or object's data.
When an email address is invalid, no email content will be created. Instead, an error is reported for the record with an invalid email address.
If an attachment cannot be found, no email content will be created and an error is reported for that record.
Note: Content creation may be aborted by a script in a Connect template that raises a fatal error. This triggers the On Error tab of the Content Creation task. See Designer Script API.
Note: The number of log messages for any non-fatal errors is limited to 100. Non-fatal errors are errors related to one record that will not stop the processing of all records.
Output
The output of this task is twofold.
On the OL Connect Server's side, pre-rendered email messages are saved in the OL Connect File Store along with their attachments (and, optionally, also in EML format).
On Workflow's side, information about the pre-rendered email messages becomes available to the process via the current Metadata or via a JSON data structure that replaces the active Job File.
Note: If you want to work with the returned data, for example to download messages, it is preferable to use the JSON data output method and iterate over the information in that data.
In the Metadata, there may be a discrepancy between information about the input data and the returned data, as the returned data is written to the Metadata in the order it is returned by the OL Connect server, which may differ from the order of the input data specified in the Metadata (vger_fld_properties).
Here is an example of the JSON structure. In this case there's only one email message in the Content Set.
{"messages":
[
{"attachments":[
{"name":"att0307c655-e14e-4400-8f90-365032648aed.png","disposition":"inline"},
{"name":"myPDF.pdf","disposition":"attachment"},
],
"subject":"Take action now",
"to":"recipient@gmail.com",
"from":"sender@yourdomain.com",
"folder":8768,
"eml":"c5f97db0-45ca-4f1d-be4d-473d000c92bd.eml",
"body":"07decd87-d03c-4969-bc2a-7527cc594878.html",
"text":"7a4e5217-0103-487f-a4f8-77d37d0c1087.txt"}
],
"contentSet":8769}
For any non-fatal errors that occur, the data record index and error message will be added to an errors
key at the same level as the messages
and contentSet
keys. The number of non-fatal errors that can be logged is limited to 100.
Properties
General Tab
-
Template: Click the Browse button to select a template from the resources (see OL Connect resources), or enter a dynamic template name. Right-click the field to open the contextual menu that allows to select variables, data and lookup functions (see Data selections).
Note that it is mandatory to specify the sender (the "from" field) in the template. Otherwise, the email service provider will return an error through Workflow. -
Section: Enter the section name that will generate output. Right-click the field to open the contextual menu that allows to select variables, data and lookup functions (see Data selections).
Only one section can be output. If no section is defined, an error will be thrown. -
Data Source (see Input):
-
Metadata: The Metadata must contain information regarding a valid Record Set, or JSON data. This can be the output of the Execute Data Mapping task or Retrieve Items task.
-
JSON String: a JSON object or an array of JSON objects representing records (see JSON string examples) or a JSON Record Data List (see the REST API Cookbook and JSON Record Data List example).
This option requires that keys in the JSON data have matching field names in the data model of the template. When they have, the JSON values are passed to the template; the personalization scripts of the template will have access to the values through the record's data fields. (See the Designer help: Adding Variable Data.)Caution: The JSON format is not validated by the plugin; it is passed as is to the server.
-
-
Output Method (see Output): Select how to output information about the emails that were created, including the email addresses (to, from, etc.), subject, and the names of the folder, HTML file, attachments, (optional) plain text email file (see Email output settings in the Email context and sections) and EML file (see below).
-
Metadata: Write the information to the current Metadata.
-
JSON Data in Job Data File: Return the information in a JSON structure that replaces the current Job File. This allows you to manipulate the output in a Run Script task before sending it to an Email Service Provider (ESP).
-
-
Additional Output:
-
Render messages in EML format: Creates an EML file containing the HTML email, its attachments and (optionally) the text version of the email, and saves it in the File Store. EML files can be used for archiving. You could use the Download EML Messages plugin to download them from the File Store. Alternatively you could use the File Store - Download File task; in that case you will need the folder ID and EML file name found in the output of the Render Email Content plugin.
-
Note: Information about the Connect Server (host, user name etc.) is taken from the Workflow Preferences (see OL Connect preferences).
Advanced Properties
To get access to the following properties tabs, right-click the plugin in the process and select Advanced Properties.
On Error Tab
For a description of the options on the On Error tab see Using the On Error tab.
Miscellaneous Tab
The Miscellaneous tab is common to all tasks.
It contains a text area (Task comments) that lets you write comments about the task. These comments are saved when the dialog is closed with the OK button and are displayed in The Task Comments Pane.
Check the option Use as step description to display the text next to the icon of the plugin in the Process area.
The tab also provides an option to highlight the task in The Process area with the default color, set in the Preferences (see Colors), or the color selected or defined under Highlight color on this tab.
To revert the selected highlight color to the default color, open this tab, turn the Highlight option off and close the dialog with the OK button; then turn highlighting back on.
Highlighting can also be turned on and off via the task's contextual menu and with the Highlight button on the View ribbon.