Manually Integrating Forms with Workflows Using Rule Actions

When you select a form in the workflow designer for starting a workflow or actioning a task, rules are automatically inserted into your form. This is the recommended approach for most applications, and you can find more information about doing this at Workflow Designer Form Tab. You can, however, manually integrate your form with a workflow by configuring the following rule actions:


In this example there is a Customer form containing a Customer Item view. The following rules integrate the form with the New Customer workflow:

Integrate the Customer form with the New Customer workflow by following these steps:

  1. Create a new workflow called New Customer, double click the Start event to edit the event, and select Start with a Form.
  2. Select the Customer form and click OK.
  3. The Start Workflow from a Form page displays the References as shown below. See the Workflow Form Tab topic for more information. Click Next.
  4. Select the option I will do it myself later and click Next, and then click Save and Finish.
  5. Click OK on the Success page.
  6. Add a task to the workflow.
  7. Configure the task instructions and actions.
  8. On the Form tab, select SmartForm as the Form Type and select the Customer form.
  9. The Open Task on a Form page opens. Click Next.
  10. Select the option I will do it myself later and click OK.
  11. Deploy the workflow.
  12. Edit the Customer form and go to the Rules tab.
  13. Edit the On Customer Item, when Create Button is Clicked rule. This is the rule that starts the workflow.
  14. Add the Start a Workflow action and select the New Customer workflow. This action starts the workflow when the Create button is clicked on the Customer Item view.
  15. Click configure next to Start a Workflow to map an item reference, and drag the Customer SmartObject to the item reference as shown below. This links the Customer SmartObject as a reference to the New Customer workflow.
  16. Click Finish to save the configuration and then OK to save the rule.
  17. Next, add a form parameter to use with the workflow activity and worklist item rules. Navigate to the Parameters tab and create a parameter called SerialNo of type Text.
  18. Go back to the Rules page and add a state called Workflow Task which helps to separate the rules of different workflow tasks.
  19. Edit the When the Form is Initializing action of the Workflow Task state.
  20. Add the a Workflow Activity is specified condition and select Task. Move the definition to the top as shown in the image because the workflow condition and action must execute before the rest of the actions.
  21. Click configure next to Task and map the SerialNo parameter to the Serial Number destination. This binds the SerialNo to the task of the workflow. Click OK.
  22. Add the Open a worklist item action and select Task, then move the definition to the top:
  23. Click configure next to the Open a worklist item action.
  24. Map the SerialNo parameter to the Serial Number destination. This binds the SerialNo to the worklist item. When you open the form, it checks if it is the correct workflow activity and then opens the worklist item linked to the activity.
  25. Click Finish to save the configuration and then OK to save the rule.
  26. Click Add Rule and add the When the Workflow View is being submitted event.
  27. Add the Action a worklist item action and select Task.
  28. Click configure next to Task.
  29. Map the SerialNo parameter to the Serial Number destination and map the Action to the Action Name destination. When you action the worklist item, it uses the SerialNo to action the task.
  30. Click OK to save the configuration and then OK to save the rule.
  31. Finish the form. You have now manually integrated the form with the workflow.
  32. To test the integration, run the form, type some information, and then click the Create button. Open the task in K2 Workspace to see your form.