Flow and Process Builder List View with Batch Delete V2
Created by Eric Smith
This Post was most recently updated on: 3/31/23
Current Version: 2.0.3
Updated to allow installation in a Production org
This version will ignore FlowOrchestrationWorkItems
NOTE: To batch delete inactive Flows in a Production org you will need to comment out line 124 of ers_DeployDeleteinactiveFlows.cls
lvDeployOption.testLevel = ‘NoTestRun’; to lvDeployOption.testLevel = ‘RunAllTests’;
and uncomment lines 122 and 125
lvDeployOption.runTests = new String[]{‘DeployDeleteInactiveFlowsTest’};
lvDeployOption.testLevel = ‘RunSpecifiedTests’;
v2.0.1
Refactored to use the current version (V3) of the FlowActionsBasePack
I’ve been following a couple of ideas on the Idea Exchange for a while now. One has over 12,000 points and 13 merged ideas. Process Builder – List View and the other Allow Mass Deletion of Inactive Process Builder Versions has over 7,000 points with 4 merged ideas.
I don’t know about you, but I get pretty frustrated trying to view and keep track of all of my Flows and Process Builders. A better List View would certainly be appreciated.
When it comes to trying to clean things up and delete some old inactive versions, it becomes downright painful.
- Find the Process Builder,
- Expand the list,
- Find the old version,
- Click Delete,
- Click Confirm,
- Wait,
- Wait some more,
- Go to select the next one —
- Oh ^#%$@ I have to start all over again!!!
I decided to put my Datatable component to work and updated it to support Apex-Defined object variables. Using data pulled from three different Salesforce internal objects, I’m able to display details about Flows and Process Builders. The full power of the Datatable component comes into play by offering a List View with sorting, highlighting, filtering and more.
Taking advantage of the Datatable’s ability to select multiple records and pass them along in a Flow to be acted upon, I created a Flow Action that interfaces with the Metadata API and handles the batch deletion of the selected inactive Flows and/or Process Builders.
I’ve bundled all of this together in an App that includes a configurable List View, List View with batch selection for delete and a Flow Picker where you can select a single Flow or Process Builder and then work with a List View of all of its active and inactive versions.
Here’s a video of the component in action.
How to Use
The Flow & Process Builder List View with Batch Delete flows are all contained in a special App.
Find the List View & Delete App by clicking the Waffle.
Type in flow and click on the Flow & PB List View and Batch Delete app.
You could also select View All and select it from the App Launcher.
The focused Flow on the app screen is the List View generator. Here you have the option to create a List View of just Process Builders, just Flows or a combined list with both. You can choose to show just active, just inactive or all statuses. You also have the option to include or exclude the Description column.
If you choose to show both active and inactive Flow versions, you are given an additional option to select a row highlight format for active Flow versions.
If you have a large number of Flow versions, this component may exceed SOQL limits. If that is the case, you can select a Lower and/or Upper value for the API Name in order to reduce the number of selections to be displayed.
Here is a sample List View including the Description column.
Standard datatable features include the column text formatting.
This sample shows the List View when the Description column format is changed from Wrap Text to Clip Text.
You can also set Filters on each column.
This view shows just Active flows with a Process Type of Workflow.
Here is the same List View of Process Builders sorted by the Object the Process Builder is based on.
The links in the Label column are active and for Flows they will take you directly to the Flow Builder for the clicked on Flow.
Because of the way Salesforce built the Process Builder editor, you will only be taken to the original Process Builder selection screen when clicking on a Process Builder link.
The App page lets you select from 3 different Flows to be run in Full-Screen mode.
The List View Only Flow is what has already been shown in these instructions.
The List View with Option to Delete Inactive Versions Flow functions the same as the regular List View with the added option of being able to select Flows or Process Builders and pass them along to be batch deleted.
Here is an example of showing both active and inactive Process Builders and selecting some for deletion.
Select Options
Display List View
Select Inactive Versions to Delete
Confirmation Screen
Don’t worry about accidentally selecting any active versions. They will be removed from the list before you get to the confirmation screen. Here, as well, you can unselect any you don’t want to delete.
Before proceeding, you will need to change the ARE YOU SURE? Toggle to DELETE and scroll past the bottom of the screen to click Next.
The delete request is sent along to the Metadata API and you are returned to the Flow. If you want the Flow to wait until all the deletes are completed you can change this attribute in the Flow and Process Builder Display Datatable and DELETE Flow.
The final Flow in the App is Select a Single Flow or PB with Option to Delete Inactive Versions.
Here you are presented with a picklist of all of your Flows or all of your Process Builders.
After you make a selection, you will get a List View of all versions just for that particular Flow or Process Builder. Here you can select the ones you want to delete.
And proceed like you did before.
When you are done with any of the Flows, click the Flow & PB List View and Batch Delete tab to return to the App home screen.
Installation
Step 1
This Application requires the following prerequisites:
- FlowActionsBasePack v3.0.0 or greater
- FlowScreenComponentsBasePack v3.0.7 or greater
- Datatable v4.0.8 or greater
- flowpickerFSC v1.5 or greater
- NavigateEverywhereAction v1.1.1 or greater
Step 2
Install the Batch Delete Inactive Flows application
Production or Developer Version 2.0.3
Sandbox Version 2.0.3
Step 3
This application includes a Batch Delete Flows Permission Set. Assign this Permission Set to any users who will be using the application.
Detailed Permission Set Instructions
Step 4
Because this component uses Metadata apis, you’ll need to have a Remote Site Setting on the org. If you don’t, you’ll see an error like this the first time you try to delete a flow:
You will need to configure your org to essentially allow applications to run that call out to the internet and then back into the same org via its api endpoints.
The best way to get the correct endpoint is to force the error.
Detailed Remote Site Setting Instructions
Detailed Permission Set Instructions
The next step in the deployment is to assign the Batch Delete Flows Permission Set to any users who will be running the app.
In Setup, type in perm and select Permission Sets. Then click the Batch Delete Flows permission set label.
Click Manage Assignments.
Click Add Assignments.
Select the Users and click Assign.
Detailed Remote Site Setting Instructions
Because this component uses Metadata apis, you’ll need to have a Remote Site Setting on the org. If you don’t, you’ll see an error like this the first time you try to delete a flow:
You will need to configure your org to essentially allow applications to run that call out to the internet and then back into the same org via its api endpoints.
The best way to get the correct endpoint is to force the error.
Find the List View & Delete App by clicking the Waffle.
Type in flow and click on the Flow & PB List View and Batch Delete app.
Select the Select a Single Flow or PB with Option to Delete Inactive Versions option then click Next.
Select a Flow or Process Builder that has inactive versions and click Next.
Select an inactive version and click Next.
Select DELETE on the ARE YOU SURE? Toggle, then scroll down and click the Next button.
If you do not have the correct Remote Site Setting yet you will get a Flow Error Email. Copy the endpoint url listed in the error message as you will need it in the next few steps.
In Setup, type remote, select Remote Site Settings and click New Remote Site.
Give the Remote Site a name, paste in the url you copied from the error message and click Save.
That’s it. The App is ready to go.