Flow now allows us to update data in entities other than the launching entity! Earlier we could only update data in launching entity or entities related to the launching entity. With our recent enhancement in the flow tool you can now update data in both related or unrelated entities. This can be accomplished with Set Variable and Update Data action types.
Example: Update Data in entities other than the launching entity or related to the launching entity
With this example we will update a task through a flow when the user profile is updated even through User and Task entities are not related.
Create a flow with launching entity as 'User'.
Set a variable from the Task entity so that it can be used when we update task through this flow. Notice that Set Variable action type now allows you to select specific type of variable.
For this example we will select Record type variable and select Task entity to set up the variable.
We are going to add a filter on the Task Title, Assigned to and task creation date. When system finds a task matching the type specified in Set Variable action type (5), it will update that task.
Note: You can set one or more than one filter when setting up the variable.
Once the variable is set successfully, you need to create an Update Data action type.
You can also specify what type of record you wan to update in Update Data action type. For this example we will select 'Record variable defined earlier in this flow'.
Once the record type is selected(6) , you can select the variable (7)defined earlier in the flow.
For this example, select the task status field 'Is Completed?(8).
Save the action type and activate the flow.
To start the flow, go the User Profile and hit save.
Once the the profile is saved successfully Task matching the filter criteria specified in the Set variable action type will be marked completed.
Note: If task matching the title. assigned user and created date specified in the set variable action type does not exist in the system, Flow results is error.
Note: Once an Action Type is created, it may not be deleted if it is used by other records.