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.
The Render Email Content task works only if PlanetPress Workflow is licensed for sending emails. It is not available for users with Demo, Test or Reseller licenses.
For the Render Email Content task in PlanetPress Workflow 2020.1 to function correctly with the SendGrid and Mailjet plugins, the version 2020.1 of those plugins is required. They are available for download on the Resource Center (help.objectiflune.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.
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.
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.
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. For example, when the recipient’s email address in a record is invalid, that record produces a non-fatal error; subsequent records will still be processed.
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 become available to the process via the current Metadata or via a JSON data structure that replaces the active Job File.
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}
Properties
General Tab
-
Template: Click the Browse button to select a template from the resources (see 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.)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.
-
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.