Create Web Content

The Create Web Content task generates the output of the Web Context of a specified template for a single record and returns the HTML code to PlanetPress Workflow for further processing and return to the requester. Generally, this task is placed within an HTTP Server workflow.

This task can be added as an Action task (see Action tasks) or as an Output task (see Output tasks). Adding it as an Action task enables the process or branch to continue after this task. An Output task is always located at the end of a process or branch.

Drag-and-drop a template from the Connect resources in the Configuration Components pane on a process to add this task or one of the other OL Connect tasks that create content from a template: a Create Email Content task, a Create Preview PDF task, or a Create Web Content task.

Input

This task must receive either a valid Record ID or a JSON object.

Record ID

A valid Record ID can be retrieved from various data sources. By default, when the Record ID input option is selected, the metadata is used as input. The Execute Data Mapping task and the Retrieve Items task output metadata containing information regarding records.

JSON

The Create Web Content task supports two types of JSON:

If the input is JSON data, the task makes a call to the REST workflow/contentcreation/html/{templateId} endpoint on the Connect Server. For more information see the REST API Cookbook.
Note that only the first JSON object is processed, as the endpoint generates HTML output for a single record.

Processing

For a single record, this task generates the output for the Web Context of the specified template. Any external resources such as images, CSS style sheets or JavaScript files, are also produced and put aside on the OL Connect Server component.

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.

Output

The task outputs HTML code as a job file. Within this HTML code, references to external resources point to the local OL Connect Server and are served to the requester directly when the HTML file is opened in a browser.

Properties

General Tab
  • Template File:
    • "%o": Select to use a dynamic template name. Click on %o to change the expression that determines the name of the template to use.
    • Template Names: Select the appropriate template. Adding template is done through the Send to Workflow option in the Designer Module.
  • Section: Enter the section name that will generate output. Only one section can be output. If no section is defined or if the section name is invalid, the default section will be output.
  • Data Source (see Input):
    • Record ID:
      • Enter a valid Record ID, or 0 to provide no data. The record must be valid for the template used. By default, the record ID is pre-filled with the first record in the metadata. Right-click the field to access other data selection methods (see Data selections).
      • Update Records from Metadata: If the process's Metadata has been modified by any of the Metadata tasks, check this option to update the records in the Connect database with the Metadata and use the updated records.
    • JSON:
      • 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 and 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.
        Only the first record or JSON object is processed, since this task can only generate HTML output for a single record.
  • Embed all resources: Check this option to download the resources and embed them in the HTML file.
  • Do not alter HTML: Check this option to prevent that the Create Web Content task modifies the HTML. It is recommended to use this option if the template's resources are all hosted outside of the template (for instance, on a CMS repository).
    By default, the Create Web Content task inserts a <base> meta tag in the generated HTML, specifying a default URL and target for all links on the web page. By pointing to the Connect Server the job was sent to, the <base> tag enables the HTTP server to retrieve the resources that were saved with the Designer template. Since the <base> tag corrupts local anchors - links to another location in the same web page -, the task also replaces the HREF attribute of local anchors with JavaScript code. With this modification, local anchors will work; however, relative URLs with hashtags still won't work.
    Modifying the HTML this way isn't useful when all resources are either embedded in the HTML file, or hosted outside of the template. So when the "Embed all resources" or "Do not alter HTML" options (or both) are checked, the <base> tag isn't added and local anchors aren't modified.
  • Runtime Parameters: The runtime parameters defined in the selected template are displayed and their values can be set here. (See Runtime parameters in the Online Help of OL Connect.)
    Right-click the field to open the contextual menu that allows to select variables, data and lookup functions (see Data selections).
    If the template name is dynamic, you must enter the name (or select a variable that contains the name) and set the value of all runtime parameters that may occur in the template.
    If a runtime parameter is defined in a template, but not set in the task properties, an error will be raised. Note that it is not possible to change a parameter's type here; that can only be set in the template itself.
    At runtime, Workflow passes the parameter values as strings, and the type defined in the template will be used to try and parse the input parameter value. In order to make this work: Boolean values need to be entered as either “true” or “false”. (When the comparison actually occurs, it will be a full Boolean comparison. Thus it can compare this runtime parameter with Boolean data values that are stored as 0/1 in data fields.) Numeric string values need to be parseable as a number (either a whole integer or decimal value). Dates should be in an ISO8601 compatible format (e.g. 2019-10-15) or use the current Windows Locale date settings options. The latter is not recommended as it requires all computers in the cluster have the same locale data format.
Runtime parameter value settings are not preserved when switching to a different template and back, for example to reload a modified template. This issue is fixed in PlanetPress Workflow 2022.1.
OL Connect Proxy Tab

This tab is common to all OL Connect tasks and defines where to process the jobs sent through these tasks. When these fields are empty, they use the defaults set in the OL Connect preferences.

Defaults are not used unless the configuration is sent to the Workflow service.

  • OL Connect Proxy Address: Enter the machine name or IP Address where the OL Connect Server resides.

  • Port: Enter the port to use to communicate with the OL Connect Server. Default: 9340

  • User name: Enter the user name expected by the OL Connect Server.

  • Password: Enter the password expected by the OL Connect Server for the above user name.

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.