Workflow Start Forms and Task Forms

Watch Video

The integration between Forms and Workflows boils down to using Rules and Actions to start Workflows and open/complete workflow tasks. When using SmartForms with Workflows, it is helpful to understand the relationship between the Workflow and the Form being used to interact with the Workflow. For example, you might use one Form to start a Workflow, but a completely different Form to open and complete a workflow task. Or you may want to use the same Form to both start the Workflow and complete a task in the Workflow, but use different States in the Form to determine whether the Form is starting the Workflow or completing a task.

There are separate Rule Actions to interact with Workflows, depending on what you want to do with the Rule. It is easiest to think in terms of Start Forms and Task Forms. Start Forms use a single action to start a Workflow, while Task Forms use two actions: one to open the worklist item based on a Serial Number when the Form is opened, and another action to complete the current task when something happens on the Form.

Start Forms

Start Forms use the Start a Workflow action to start a Workflow. This action is usually contained in a Rule for a Button Click event or some other user-driven event. In the example below, the Start Workflow button’s Rule calls the Start Workflow action to start the sample Workflow.

The Start Form is typically opened and completed by a user before the Workflow even exists: the Workflow is only started when the user takes some action on the Form. These Start Forms are usually “capture Forms” or “user input Forms” where the user will complete the Form with information before submitting the Form. In the majority of cases, the Submit action will save the data to some data store by calling a SmartObject method, and then start a Workflow in the same Rule. While these input Forms are normally purpose-built for Workflows, remember that you can re-use Views on the Form to save development time; you can also use Rule conditions to start Workflows based on some condition.

The Start Form would use a Rule calling the "Start a Workflow action" to initiate the Workflow. As part of the configuration of this action, you can set the Folio of the process that will start, set any data fields in the process, set the priority of the process instance, and the expected duration.

A Form Rule used to start a Workflow

Task Forms

A Form used to complete a workflow task (also known as a worklist item) usually contains two workflow-specific actions: one action opens the workflow task when the Form is initialized, and another action completes the workflow task when the user takes an action on the Form. (Remember that actions are contained in Rules, and these Rules would be configured to fire at the appropriate times.)

The first step is to open the associated task with the "Open a worklist item" action, using the Serial Number to locate and open the workflow task. This rule is usually executed when the Form is initialized, and would usually also read the available actions for the task so that these can be presented to the user in some way, normally a drop-down menu. You can also read data from the Workflow instance, like the Folio or data field values.

This next image shows that when the Form associated with the Approval step is opened, then open the worklist item for this task. When configuring this Rule, you will have to provide the Serial Number for the task: this Serial Number is a unique value that is usually passed as a Form parameter. We have highlighted the Serial Number in the screenshot below to show where is it usually found.

By default, opening a worklist item allocates the item to this user and they either need to complete the task or release it.


A Form Rule used to open a User Task worklist item (notice the SerialNo parameter)

The second part is executed when the user wants to complete the task, normally with a button click event. This part would use the "Action a Worklist Item" action to complete the workflow task. You would normally pass through the action that the user selected as part of the action configuration so that the Workflow knows which way to go next. As part of the action, you can also update the process Folio and process data field values.

The Action name used in the configuration for this step must exactly match the Action name defined in the Workflow, otherwise the Action will not complete successfully.

A Form Rule used to action (complete) a User Task worklist item

Summary

K2 smartforms3.1
Video Links Learn Support
No videos found for this article
K2 on YouTube
No Additional links found for this article
No self-learning content for this article
Try some scenarios...
No relevant support links available for this article