Manage templates
Templates provide a way to reuse objects within the Intelligent Automation Cloud. Almost every object within the Intelligent Automation Cloud, including tasks and BPs, is based on templates.
To start managing Templates, go to Advanced > Templates, where you can apply the following actions:
- Create or edit
- Copy
- Export or import
- Delete
- Filter by type

Create and edit template
While editing or creating a template, you can access the following tabs:
Content
You can write plain text, XML, HTML, CSS, JavaScript, and FreeMarker directives in the Template Content box and save the result.
You can also modify the Template Type.

History
The History tab displays all saved versions of a particular Template along with the author names and modification dates.
To view the template code, click on the appropriate link in the Template Name column – the code is displayed under the grid.

To compare two different template versions, select appropriate checkboxes and click the Compare button. The selected two versions are displayed under the grid with all their differences highlighted.

Copy tasks with and without templates
When copying tasks, you have the option of creating a copy of the existing template, or creating a link to it that will enable changes to propagate when either task is modified.
When copying templates, changes made to the new task will not affect the original task and its associated template, while changes made to a task with a linked template will.

tip
See Copy Task and Copy Business Process for detailed info.
Template variables
Refer to FreeMarker engine variables.
To use an object in code, you need put it inside a <#if ??> tag:
<#if worker??>
Worker Name: ${worker.firstName}
</#if>
You can also create a hidden answer and pass some info into it to view it on Results > Data. For example, this code snippet submits the Worker ID in a separate column:
Pass Worker ID to task results
<#list questions as question>
<input type="hidden" name="${question.identifier!}_worker_id_skipCheck"/>
<script type="text/javascript">
$(document).ready(function() {
$("input[name=${question.identifier!}_worker_id_skipCheck]").val($('#workerId').val());
});
</script>
<#if run??>
<@input type="hidden" name="_sys_executorId" value="${workerId!}:${run.questionUUID}" question=question answer=false class="executorId"/>
<@input type="hidden" name="_sys_human_task_title" value="${run.question.title}" question=question answer=false class="humanTaskTitle"/>
</#if>
</#list>
You can use the following variables in all templates, except Machine and Base_Machine.
| Variable | Type | Description |
|---|---|---|
questions | list of object | Questions list usually used in the following form: Variable usage example <#list questions as question> Question text:Field #1: ${question.data.field1}Field #2: ${question.data.field2}<@answers question=question/> </#list> |
question | object | class: com.freedomoss.appliance.model.QuestionDTO |
question.data | map | Main data. Can be used in the form: question.data.column_name |
question.isGold | boolean | Is the gold question |
question.order | number | Question order |
question.answers | list of objects | Question answers |
submissionUUID | string | UUID of the task submission |
workerId | string | Worker ID assigned on the endpoint |
worker | object | Object with the current worker info. Can be empty (null) when a worker is previewing the task and has not accepted it yet. class: com.freedomoss.worker.model.Worker |
worker.id | number | Worker ID in the WorkFusion database |
worker.uuid | string | Worker UUID |
worker.nativeWorkerId | string | Same as worker ID (see above) |
worker.firstName | string | First name |
worker.lastName | string | Last name |
worker.nickname | string | Nickname |
worker.creationDate | datetime | Worker's registration datetime |
worker.country.name | string | Worker's country (can be empty if the worker's country cannot be determined) |
worker.lastActivity | datetime | Worker's last activity datetime |
countryCode | string | Worker's country code (if detected) |
assignmentId | string | Assignment ID |
mturkExternalSubmit | string | URL to submit a task form (for unsecure submit through http) |
secureMturkExternalSubmit | string | URL to submit a task form (for secure submit through https) |
hitTypeId | string | Hit type ID (as defined by the endpoint) |
Template types
Macro
Macro templates are libraries that contain custom tags used to build the task and Base templates. They contain necessary imports, scripts, structure, and styling.
Macro templates can have the following extensions:
- ftl used in task Code Editor
- css for answer type styling
- js answer behavior
Update Macro template
There are two ways to update a Macro template:
- Go to System Settings > Advanced and click on the Install Macro Templates Version button.
- Automatic update is executed as you launch the application for each new revision.
important
Manual modification of a Macro template through the Control Tower UI is strictly forbidden. If you need to make changes to Macro templates, add a feature request or create a bug ticket to the WorkFusion development team. Mind that WorkFusion tracks the history of template updates, so if needed, the template content can be restored.
List of basic Macro templates
| # | Name | Description |
|---|---|---|
| 1 | html.ftl | Base template that converts data, scripts, and formatting to HTML |
| 2 | answers.ftl | Contnains macros for all defined answer types |
| 3 | extras.ftl | Includes gold and training macros |
| 4 | answer_information_extraction.ftl | Used to render the information extraction answer type |
Base ( + Base_Machine)
WorkFusion's Use Cases are based on this type of template. These templates contain the code for the task design, including the Instructions, Questions, and Answer choices if any.
They specify the format of the input file. Designed into the application by default.
When you create a task using a Base template, a copy of the template is created and linked to that task. Duplication of the Base template ensures that the original template will remain consistent and will not be altered unless required.
As tasks are created, a new copy of the Base template will be associated with the new task. The following graphic illustrates this inherent design:

Task
Every time a new rask is created or copied, a template for that task is created. This template contains the code for the task design, including the Instructions, Questions, and Answer choices if any.
It also handles the passing of information such as the input data for the task and the answer data entered from workers.
The FreeMarker code of a task is available in task's Code Editor.
Task templates have include links to FTL files (extras, HTML, answers) of Macro templates.
Machine
Bot Config XML code written using the WebHarvest language.
Availability
Availability templates allow you to define an alternative UI for the task when the task is not available for execution.
An example scenario for implementing this template would be when time constraints exist within the timing of a task. If a task is set up to call a business, you might require the task to only run during normal business hours. This Template controls the Task timing.
Notify, Crowd_Notification
Notification template used to communicate with workers concerning tasks.
Text message when new tasks are available for workers. Set in Task Advanced Options > Notifications.

Accept/Reject
The notification template is used to convey to a worker that a task has been accepted or rejected.
It contains the message text sent to a worker when a HIT is accepted or rejected. Set in Task Advanced Options > Notifications.
Example of the accept template:
Your Task is approved:
<#if (data.approved?size > 0) >
<#list data.approved as assignment>
Assignment[${assignment_index}]:
Title: ${data.question.title}
Reward: ${data.question.amount}
</#list>
</#if>