Toggle menu

Linking Directly to Workflow Tasks

In most circumstances your users will interact with workflow processes by logging into your site and using the Self Service or User Requests templates via the "My Account" area of your site.

It's also possible to link directly to workflow tasks, displaying the next task form on any article that uses the Forms Service template.

Link Format

To link to a task, add the process instance business key as a parameter to any link to an article using the Forms Service template. If you are working in a Mail Activity in a process model, the instance's business key can be accessed in the _businessKey process variable:

www.mywebsite.com/myform?bk=${_businessKey}

You could also use the _startPageURL process variable in your link, which will almost certainly be a page on your site using the Forms Service template (because almost all process are started by a form submission). 

The Forms Service

In the example above, /myform is the friendly URL of an article using the Forms Service template. Any article using the template can be used - it doesn't even need to have a form related to it.

When the Forms Service template sees the bk=1234-1234-1234-1234 parameter, it automatically calls the Workflow worker and looks up the process instance with that business key. If the process execution has arrived at a user task that is assigned to the current user, the template will display the appropriate task form and the user will be able to carry out the task.

Linking to tasks doesn't prompt a user to log in. Securing the Forms Service article you use in your link will. Once logged in the user will be redirected to the task form.

Assigned Tasks

As standard, with no extra configuration, interacting with tasks in this way will only work if the current user already has a task assigned to them. The current user might be the defined assignee for a task, or they might have claimed the task earlier on in the process. If the current user isn't already assigned to the task, the task form won't be displayed.

If the user has more than one task in the current instance assigned to them (if the workflow splits using a parallel gateway for example) then only the "first" task form will be displayed.

Candidates and Auto-Claim

Rather than sending out links to users who are already assigned tasks, you can also send links to users who are candidates for tasks. The link you send is the same.

So that candidate users can perform a task, the user task activity has to have auto-claiming enabled. To enable auto-claiming, open the "Advanced" tab of the user task activity you would like to be auto-claimed. Click on "Task listeners". From the default behaviour drop-down select "Allow Auto-Claim" and press the plus icon, then save.

Now when one of the eligible candidates clicks on the link the task will be automatically assigned to them and they'll be shown the task form, just like if they were an assignee.

If the current user isn't an eligible candidate, auto-claiming will fail and the task form won't be displayed.

If an eligible candidate follows a link to an auto-claimable task that has already been claimed by someone else, the task form won't be displayed.

When using auto-claim you might want to configure a timer to return the task to the list of candidates. If you don't the task could be auto-claimed by a user, who then doesn't complete it, preventing anyone else from claiming it.

Anonymous Users

Having all your services, processes and tasks carried out by registered, logged-in users has lots of advantages. However, having everyone register with your site is not always possible, and you might need users to be able to carry out tasks without being logged in.

If your task can be assigned to or claimed by your site's anonymous user, and the Forms Service article in your link is not secured, then the task can be carried out without logging in.

See Users and User Groups and Securing Content for more information about anonymous users.

Last modified on 20 February 2024

Share this page

Facebook icon Twitter icon email icon

Print

print icon