Audience
  • Developers
Required Knowledge
  • K2 Workflow Designer

Introduction

Simplified mapping between workflows and SmartForms makes it easier to integrate the two. The SmartForms Workflow wizards can automatically map the SmartObjects IDs between the workflow and your Forms. Data Fields are created for every Key and Unique field of the SmartObject if the checkbox Map identity fields to the workflow is checked in the K2 Workflow Designer. The identity fields will automatically be populated and are created using the following naming convention:

View Name-SmartObject Name-Field Name

The Data Fields automatically created from the bound View or Views can only accept values from an Item View or Editable List View where records are created. Values from a List View cannot update these fields. The identifies can be changed if required by editing the Data Field.

Consideration

The Map identity fields to the workflow option has been replaced by the option to create an Item Reference from a SmartObject in K2 smartforms 1.0.2. Data Fields are no longer automatically created for the identity field of the SmartObject. An Item Reference is now created using the default SmartObject linked to the Form.

It is advised to use Item References when configuring new workflows in K2 smartforms and keep the existing configuration for workflows configured prior to K2 smartforms 1.0.2. For more information on using Workflow Integration Item References, see the following:

Implementation

To demonstrate the Workflow Integration feature, we have a scenario of a SmartObject that contains an identity field that is used in a workflow. This field is then used to load a Form. The mapping is done automatically when selecting the option to Map identity fields to the workflow.

Follow the high level steps below to set up the scenario as described above:

  1. Create a Client SmartObject with your desired properties. Be sure that there is an ID field.
  2. Generate an Item View and a Form from the Client SmartObject.
  3. Create a Workflow by right clicking on the Client Form and select Design Workflow.
  4. Note that the Map the identity fields to the workflow option is selected by default. This will ensure that the SmartObject identity field is mapped to the workflow Data Fields. Click Next.
    Image
  5. The Data Field created from the Client SmartObject is listed on the Data Fields screen. All fields marked as Key and Unique will be listed here. In this instance only the ID field was marked as Key and Unique. Click Next.
    Image
  6. Click Next on the Start Form screen.
  7. The Data Fields are automatically mapped to Client SmartObject Key Property values. Click Next.
    Image
  8. Continue with the wizard and provide workflow rights. Finish the wizard.
  9. Drag a User Task onto the workflow.
  10. Complete the first step. Click Next.
    Image
  11. Click Next on the Workflow Step Outcomes step.
  12. Note that the Transfer the identity fields to the form option is selected by default. Click on the Data Bindings button.
    Image
  13. The mappings are automatically done between the newly created Data Fields and the SmartObject. Click OK and Next.
    Image
    Image
  14. Finish designing your workflow and deploy it.
  15. If you edit your Client Form, you will notice that the rule actions for starting a workflow and opening a worklist item are automatically mapped to the process data fields:
    Image