Process Automation Integration
Launching a workflow with event triggers for workitems
Process Automation can be used to respond to events published on task management notification topics to trigger an action. For example whenever a workitem of a certain worktype is created we can launch a workflow.
This is accomplished using triggers. Triggers can be created with a set of criteria and a target workflow. When the criteria is matched, the target workflow will be launched. Triggers can be defined using the POST /api/v2/processautomation/triggers.
- For more info on configuring triggers, please review this article
Examples of Triggers
Examples of triggers can be found here at this article
Using workitem event information in workflows
There are two datatypes that can be passed into a workflow: primitive and JSON object. An example of an object datatype would be custom_fields
. To access an object datatype in a workflow, the workflowTargetSettings
on the trigger must be set to Json
. Example:
{
"name": "Workitems Trigger 3",
"topicName": "v2.taskmanagement.workitems.{id}",
"target": {
"type": "Workflow",
"id": "b796bd10-b101-4a46-acc6-2705157d00e1",
"workflowTargetSettings": {
"dataFormat": "Json"
}
},
"enabled": true,
"matchCriteria": [
{
"jsonPath": "operation",
"operator": "Equal",
"value": "edit"
},
{
"jsonPath": "customFields.custom_text.value",
"operator": "Equal",
"value": "TaskRouting"
}
]
}
In the workflow, you can now declare a single variable of JSON type called jsonData
. To access Top Level Primitives (i.e name
, priority
) the format would be Flow.jsonData.name
. To access JSON such as customFields
it would be Flow.jsonData.customFields.phone_text.value
.
For more information on working with Top Level Primitives and JSON in workflow, read the process automation documentation.
Task Management Operations
Task Management events from the available topics has an operation field and it can take the following values:
add
: when a Task Management entity is creatededit
: when a Task Management entity is edited/updateddelete
: when a Task Management entity is deletedpurge
: when a workitem is purged due to a ttl expiry
Workitem Event Schema
The event schema for a workitem event can be found here from the available topics.