Using Flow to build After Create or Update Trigger

Ashwin Kumar Srinivasan
2 min readOct 31, 2020

In this blog we are going to discuss how to implement a record “After Create or Update Trigger” using flow builder. We will take a use-case of counting total number of open cases on the associated contact record when there is a new case created or when case status is updated to open.

Step 1: Create a new flow of type “Record-Triggered Flow” .

Step 2: Configure trigger option as “Record Created or Updated” and mark to run the flow as “After record save”.

Flow trigger configuration

Step 3: Choose an object on which after trigger should run, in this use-case it will be “Case”. Also select the condition on which the trigger should fire, in this use-case it will be “Status becomes Open”.

After trigger object selection

When to Run the Flow for Updated Records” option on the above screen is selected as “Only when a record is updated to meet the condition requirements” This option is selected when we want the trigger to run as change happens from not meeting the condition to meeting the condition above.

Step 4: Get the contact record associated to the case using the $Record global variable.

Use of Global variable to query for parent contact record

Step 5: Check if the contact is retrieved using “Decision” element

Step 6: Use “Assignment” element to update the “Open cases” count field(custom) on contact by adding one to it.

Step 7: Update Contact using the “Update Records” element which has the new “Open Cases” count value

Final Flow

Demo

Below is a screen capture showing when a new “Open Case” is created the count on Contact record increases from 3 to 4.

Demo: Adding new Case to a Contact with 3 existing cases

Useful Resources

Please provide any comments or feedback.

--

--