Getting form field values and saving in variables within the process

Learn to fetch form field values within the process

Last published at: May 7th, 2024

Let’s expand the process built by using some of the other form-related steps.  

Let’s use the form definition “TestFormFile,” which looks as follows:

 

Let’s use the process definition “TestFormFileDef,” which looks as follows:

 

Let's drag the “getFormFieldValues” step to the designer and connect to the last step of the process. The red alert sign indicates the step property configuration is incomplete. 

 

Click on the new step and configure the following properties. Provide the variable reference which holds the form instance ID. Click on the button to map the form fields with variables/ 

 

The popup window is displayed for configuration. Click on the AddRow (+) button to insert a blank row. Provide the form field reference in the textbox and the mapping variable reference in the adjacent textbox, as shown below. You'll need to repeat this mapping for the required form fields. Click on the Save button to confirm this configuration. 

 

Let’s define a few variables to store userFullName and email as a string data type.

 

Save the process definition. 

 

Generate and Execute a new process instance. 

 

Let’s render the instance to view its execution by clicking on the View—Render menu option. 

 

The process instance is rendered on the new page, as shown below. Use the Select Steps to Exclude drop-down list to summarize a vast instance execution path. 

 

As the rendered workflow shows, the route form step will create a task for the user. Let’s open the task list and complete the form within the task. Then, you have to navigate to the Engage—Tasks page, as shown below. Select the Instances search filter and select the process instance from the drop-down list. The incomplete task assigned to the user is shown below. You may also search for the task using the Search textbox.    

 

The rendered task with the form is displayed as follows. You can go ahead and provide the values for the form fields and click the Submit button to complete them. The form instance now stores the form field values in XML format, and the process instance completes them. 

 

Once the task is completed, the process instance should be “Completed.”. 

 

Click the Items - Variables = Latest Variables menu option to view the variable values.  Alternatively, click on the “getFormFieldValues” step and view the step properties. 

 

The Latest Variables popup window displays the list of variables and their values, as shown below. You may have to scroll the list, to locate the process variable values.