Variables allow Admins to carry values from one Task in the Flow to the next, saving double entry on forms and better ensuring data integrity. A Task can have no, one, or many Variables. Watch a video on how to use variables, or read the detailed description below.
Going through the sample Flow above:
Item 1 is where the user opens a daily production report with a form
Item 2 shows a branch where the user can then add line items to that daily production report. The line item is a child record production report, so the form used to add that line item must contain the Record ID of the parent report in order to connect the two. The Flow could ask the user to select the daily production report again on the form for Item 2 using a relationship field. However, it's more efficient for the Admin to use a Variable to carry that information from one Task to the next, eliminating the need for the user to select the correct report.
Item 3 shows the created Variable used to carry the Record ID, here labeled "JobDPR", from Item 1 through to Item 2. The Admin accessed the option to create a Variable by clicking the secondary tab of the Task’s edit panel (item 4 above), and configuring the Variable using the fields under Variable Settings.
Creating or Editing A Variable
As you can see in the image above, there are three settings for each Variable. The name of the Variable (1), the reference field from which you are pulling the value for the variable (2), and the assignment field (3) where you wish to insert the variable's value. The dropdown for the reference field (2) will show all fields from forms used in previous steps of the flow. The dropdown for the assignment field (3) will show all fields in the form for the current task.
TIP: It’s important that you carefully select the correct reference field (2). In Flows with many tasks the dropdown list might be very long, and it’s easy to select a Record ID from the wrong Task, thereby populating your assignment field with incorrect information. Make sure you double-check the bolded name of the Task and the name of the form assigned to that Task (in parentheses) when selecting the reference field that falls below that title. See Best Practices for other flow-building tips.
NOTE: Reference and assignment fields must have a one-to-one relationship. You cannot assign multiple reference fields to a single assignment field. Using more than one reference field for a single assignment field will not prevent you from saving a Flow, but the user will get a “Unique Constraint Violation” error when trying to save the Task with the duplicate assignee variables. See Limited User Errors in Flows for additional error information.