Mapping Form Field Values to Workflow Process Variables

Last published at: April 27th, 2021

In our earlier blog we used the workflow process to route a form for data entry. Let’s revisit that “TestFormDef” workflow definition and look at mapping a form field value to a workflow process variable.

Open the “TestFormDef” workflow definition in the designer for editing. Drag and drop a “getFormFieldValues” step into the designer and connect the last step (routeform) to the new step. 

Next, let’s define another workflow process string variable called “lastName”. Select the “start” step and click in the “Variables” link at the bottom of its properties pane. Type “lastName” in the Add Variable field, select “String” for Type, and click the Add button.

Click the Save button to save and close Variables page.

Click on the new “getformfieldvalues” step and configure the following properties:

Enter “variable.formID1” for the Variable that holds the form instance ID. In the Select form definition dropdown, select the form definition used in the instantiateform step. Now click the Mapping of fields to variables button:

Select “txtLastName” in the Form Field dropdown and enter “lastName” in the Variable Name field. Click the Save button on the popup and click the Save button in the step properties pane. When the Workflow Instance executes, the value in the “txtLastName” form field will be written to the process variable “lastName”. Let’s save the Definition and re-execute the Workflow Instance. 

The rendered view of the task containing the form is shown above. For this example we will select Joe Simpson from the Name Lookup and then complete the task.

Now let’s render the executed process: Click on the last step in the process to view the properties:

Mapping Form Field VariablesAs highlighted above, the variable “lastName” now contains the value entered into the “txtLastName” field within the form.

You may also be interested in reading more on the subject of Configuring a Custom Workflow Step.