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.
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:
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:
- Create a Client SmartObject with your desired properties. Be sure that there is an ID field.
- Generate an Item View and a Form from the Client SmartObject.
- Create a Workflow by right clicking on the Client Form and select Design Workflow.
- 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.
- 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.
- Click Next on the Start Form screen.
- The Data Fields are automatically mapped to Client SmartObject Key Property values. Click Next.
- Continue with the wizard and provide workflow rights. Finish the wizard.
- Drag a User Task onto the workflow.
- Complete the first step. Click Next.
- Click Next on the Workflow Step Outcomes step.
- Note that the Transfer the identity fields to the form option is selected by default. Click on the Data Bindings button.
- The mappings are automatically done between the newly created Data Fields and the SmartObject. Click OK and Next.
- Finish designing your workflow and deploy it.
- 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: