skip to Main Content

Power Automate Flow CDS new environment triggering event

When you go to use the new Power Automate Flow CDS new environment trigger you are presented with an all in one, swiss army knife trigger. With one trigger you can listing for a Create, Delete or Update vs having to use three different flows with the ‘old’ CDS trigger.

CDS New Environment Trigger

The question is: Which event triggered the flow? Unfortunately, that is not returned in the output body of the trigger.

So we need to construct a condition check process (2 levels actually) to discern whether it was a create, update or delete.

First we want to check to see if the record was deleted. We do that by inserting a condition check to see if both the Modified On and Created On are both Null, if they are then the record is gone. However, note that the trigger doesn’t haven’t any pre-image step so there is no record downstream of what the fields value were before the user performed the delete action.

In the condition check setup we are looking for both values to be Null and if true then go down the yes path, if not go down the no path and we will then check for create or update.

Deleted Record Condition Check

 

Now we need to set up the logic for the updated or created condition check. Here we want to check to see if the two date fields are the same. If they are, it must be a new record – create, if not then it was an existing record that has a modified date that is newer than the created on date. So for create we traverse the yes path, for update we traverse the no path

Modified On or Created On Record Condition Check

 

And there you go. With two condition checks you can determine which of the three events triggered the flow.

If you think this is convoluted then vote for this idea on the community site where I propose that the output body should include an event indicator value:

https://powerusers.microsoft.com/t5/Power-Automate-Ideas/CDS-new-environment-trigger-event/idi-p/601560

 

This Post Has 0 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

Back To Top