Deleting Lots of Old Flows / Process Builders 2


I’ve managed to create quite a few process builder and flows for demonstrating concepts to the community or have had multiple drafts trying to get a flow to work.  Either way, if you have quite a few process builders or flows that you’d like to get rid of, this is the fastest way to do it (it’s only worth your time if you have a lot of them).

 

Open the developer console, go to the “Query Editor” and type  the following query with the tooling API selected: SELECT Id, Definition.DeveloperName, VersionNumber, Status FROM Flow WHERE Status = ‘Obsolete’

Flow Query

You should get a screen that looks like this:

FlowResults

(I used to use column copy for this step but that apparently no longer works, which made me a sad panda – since it made this a lot faster).

Right click on the first row and select “inspect” in chrome.  Once selected, find the parent div element and select “Edit as HTML” when right clicking.   When you click “Edit as HTML” you can paste into excel and make a simple formula to append the version number to the flow name:

=”<members>”&B2&”-“&C2&”</members>”

My spreadsheet then looks like:

OldProcesses

 

Copy the last column into a file that is called “destructiveChanges.xml”.  It should look like:

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
  <types>
    <members>multi-time process-1</members>
    <members>Carlos Process-1</members>
    <name>Flow</name>
  </types>
  <version>36.0</version>
</Package>

You should then have another file called “package.xml”.  This file will have no metadata in it for your deployment. Such as below.

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
  <version>36.0</version>
</Package>

Zip the two files together and deploy on workbench using the deploy as single package functionality and all your old process builders should be removed.

Unfortunately, at this time, there is not a faster way to remove process builders / flow.  If you have hundreds currently, it is best for you to delete them via the metadata API detailed above.   If you only have 10-15, I’d recommend keeping it simple and deleting via the UI.

 

Anddddddd success!

successFlow


Leave a comment

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

2 thoughts on “Deleting Lots of Old Flows / Process Builders