Skip to content

Form Tasks

The Form task type has some unique funcitonality and is closely linked to the Form Instance API. For this task you must supply a form key and you can optionally add the form version. If this version is left empty then the latest form version will be used. You can also specify the instance ID of an existing form in the workflow definition, to link a form task to an exsiting form. If a form task is created with an instance ID already set, it will skip the 'New" status and be created as In Progress.

When this task moves from New to In Progress a call will be made to create a new form instance using the form key and version supplied. If the form is successfully created, the Form Instance Id will be added to the task, otherwise the status will remain as New. The instanceId can be pulled back using GraphQL for the form task type. If you have the Owner and OwnerType properties set for this task then these will be used during the form creation as the OnBehalfOf user. Once the task is In Progress, it can either move to Completed or it can also be Cancelled.

If the task is Cancelled then a call will be made to withdraw the form instance. Again, if this withdraw call fails then the status will remain as In Progress. You are also able to set the Form task as Cancelled when in a New state if you no longer require the task, this will prevent users from being able to create a form instance under this task.

Complete Task on Form Submission

Use this setting on a form task definition to make the task status automatically change to complete when the linked form is submitted. The subject ID, correlation ID and form instance ID must match the submitted form for this to work.

Cancel Task on Form Withdrawal

Similar to the auto complete setting, use this setting to make the task status automatically change to cancelled when the linked form is withdrawn. The subject ID, correlation ID and form instance ID must match the withdrawn form for this to work.

Return Status to New on Form Deletion

Similar to the auto complete setting, use this setting to automatically set the status of this task back to new when the linked form is deleted. Only forms that have not been submitted can be deleted. The subject ID, correlation ID and form instance ID must match the withdrawn form for this to work.

Linking a Form Task

If you want to link a form task to a form when a form instance is created, you should add a trigger using the Form Instance Created event. You can then set the Form Instance ID for that task using a liquid expression like this:

liquid
{{ context.FormInstanceCreated.instanceGuid }}