List, Filter and Delete Flows in Power Automate
The irony of creating a flow to delete some flows is pretty significant but hear me out, I have a good reason why. You can use this flow to list and filter flows, to do whatever you wish, in this case I want to delete the flow but obviously the usual health warnings apply when you are deleting things. With great power comes great responsibility yada yada. And do not ever question the power of cascading delete on Account records in Dataverse.
Why do you have so many flows to delete?
When you create a Customer Insights - Journeys ‘Journey’ it creates multiple power automate flows in the background with the prefix CXP_ that handles all the automation you built in your journey. Each journey can have 5+ flows running behind the scenes and if you edit the journey a new set of flows are spawned so it’s a number that can grow really quickly without trying too hard. Once the journey is complete or stopped, the flows are automatically turned off and left to fester in the default solution forevermore. I mean it’s not technically doing any harm there but it’s a bit sloppy, they get in the way when your trying to find a flow and for anyone who doesn’t know CI-J it’s concerning.
Once the flow is turned off, it’s of not benefit to be there. Deleting these flows does not result in any loss of analytics or anything like that. Once their job of automation is complete, they are obsolete.
The Flow Deleting Flow
This example shows you how to filter for flows which start with CXP_ and are turned off but you can adjust the filter query as needed. You can point this flow at any environment you wish so long as you have the sufficient permissions to this environment and your DLP policies allow.
To make your loop run a little faster you can turn on concurrency control but don’t go too high otherwise your flow may be throttled for too many requests within a short timeframe.
Flow Fratricide
And lets end on a joyful note that you just built a flow that commits Fratricide ‘the act of killing a brother’. But it’s a sacrifice that has to be made.