Data association refers to the flow of data within a process. Use the Data Association editor to define input and output for flow elements that need them.
On the input side, it needs data input into the activity (referred to as its payload).
On the output side, after the activity has just finished, it needs output from the activity to data objects, to store results for use elsewhere in the process.
To configure data association:
- In the process editor, select a flow element that needs data association, such as a human task or service task, and click the Data Association button in the upper right. (This button is active when the selected flow element needs association. See Data Association Tips.) The Data Association editor opens. Use its center pane as a canvas for mapping associations, by dragging and dropping elements from the left and right panes. Any data associations already configured display below Data Association. You use the empty pair of fields to create a new association.
Note:Process creates data associations for you in some cases, such as when you create a human task or start event with a form.
- Notice that the Input tab is selected. The left pane displays source objects (Data Objects) in an expandable tree. The right pane (indicated by the task’s icon) displays the payload, or entry parameters the activity needs to perform its function.
- Click the Output tab and notice how the left and right panes change. Now the left pane displays the task’s payload, and the right pane displays the variables available in the process.
- Click the Input tab again, and begin creating a new association by dragging an input object from the Data Objects tree and dropping it in the input field titled New Association. You can also begin typing and select from autocomplete options that appear. To specify attributes within objects, enter a . (period) and select from the list that displays.The input source provides the value or expression to assign to the target. You select variables related to the process (such as data objects or business parameters) to map to the specific parameters the activity needs to perform its function (its entry parameters).
- If needed, click the fx (Expression) icon and use the Expression Editor to create an input expression using standard functions and operators. See Work with Expressions.
- Complete the association by dragging an output object from the payload tree and dropping it in the output field. Process validates the new association and displays a green association icon if valid, or a red association icon and error if invalid:
Valid data association
Invalid data associationSee Data Association Tips for additional information about configuring associations.
- If the association is invalid, optionally create a transformation to convert its associated attributes. A transformation maps mismatching data types. See Work with Transformations.
- If needed, create additional associations and reorder them. Drag and drop an association to move it up or down in the associations list. Associations are executed in the order in which you position them. For example, if multiple associations assign a value to the same object, the last assigned value is used.As you edit, click the Undo or Redo buttons as needed.
- Click the Output tab, and create output data associations. You can think of the output as though the activity has just finished, and likely contains results that you'd like to store for use elsewhere in the process.
- Click Apply to save the data associations.You can save invalid associations and fix them later. Note that you can't play or deploy applications that contain validation errors.
Data Association Tips
Use the Data Association Editor to add, edit, delete, and reorder data associations.
Below are tips for configuring data associations.
The following flow elements need data association. Note that some flow elements have only output, such as a start form event, which captures the data end users enter into the form.
System tasks, except abstract and notification tasks
Events, except timer catch, error boundary, and terminate end events
You can access data association in any of these ways from the process editor:
By clicking the Data Association button in the upper right.
By clicking a flow element on the process, clicking the menu icon, and choosing Open Data Association.
By opening the Properties pane and clicking the input (right) or output (left) arrow in the lower left of the pane.
In the Data Association Editor, click the Input tab to define data input into the activity, and the Output tab to define data output resulting from the activity.
Under Data Objects, you can create, edit, and delete data objects if needed without exiting the data association editor.
Dropping an object into an association field that already contains a value replaces its value. If you drop an object into an input field that ends with an operator, the object name is appended to the field's contents.
Data Association for Enums
The Data Association Editor provides flexibility in associating enums (enumerations) and primitive types.
Note:You can also transform enum items. See Create Transformations Between Enum Items.
Follow these guidelines for associating enum objects.
You can assign an enum type to a primitive type.
In this case, you’re assigning a source that includes a limited set of values to a target that includes a full set of values. Note that the types must be compatible; for example, you can’t assign an integer enum data object to a string data object.
Use caution when assigning a primitive type to an enum type.
In this case, you’re assigning a source that includes a full set of values to a target that includes a limited set of values. The data association editor allows the assignment, but displays an Automatic Casting icon as a caution that runtime issues may result.
Automatic Casting association icon
For example, an error might be triggered when data from an automatically cast association is passed to an external service. This same behavior occurs when using explicit casting, as described in Work with Expressions.