In the previous post, I explained how to delete a file based on a change to a column in Dataverse.  I used an automated flow to delete a file stored in a Dataverse column which triggered every time the status of a row changed to cancelled

An alternative approach to using an automated flow is to use a scheduled flow that triggers on a specific timescale.  The scheduled flow checks the status of each row in the table and if the row status is cancelled, the flow deletes the associated file

The advantage of this approach is that it requires the flow to be initiated on fewer occasions.  If the files don’t need to be removed immediately on a change of status, the scheduled flow could be triggered once a day, out of hours

The scheduled flow is only slightly more complex than the automated flow covered in the previous post and is shown in full below

Scheduled Flow

scheduled flow

I’ve configured the flow to trigger daily.  When this happens the ‘List rows’ step identifies all the rows in the Appointment table that have a status of cancelled.  The status of an Appointment is a choice field and with choice fields, the value of each choice is required rather than the title.  The choice value for a status of cancelled is 2 and all the rows with this value are retrieved.  For more explanation on using Choice columns, check out the links below:

Because it’s likely that multiple rows will be retrieved, we need to scroll through all the rows one at a time.  The ‘Apply to each’ step does this and the ‘Condition’ step executes for each row

The Condition step is required because if the flow tries to delete a file that doesn’t exist, an error will be thrown. The condition simply checks whether the value of the Agenda column, which is the name of the file column in which the file is stored, is null and if it is, then no further action is taken

If the value of the Agenda column is not null then a file exists for that row.  The condition returns yes and the ‘Perform an unbound action’ deletes the file

This is a great example of how Power Automate can easily replace a potentially long and tedious manual process

Leave a Comment

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

Scroll to Top