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.
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:
- 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 samples.
- A JSON Record Data List (see the REST API Cookbook and JSON Record Data List example). When the Retrieve Items task is set to output Records in JSON, it outputs this kind of JSON data.
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.
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.
- 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).
- Record ID:
- 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.
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 User Options page of the preferences.
- 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 General appearance preferences), 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.