top of page

Salesforce Hacks # 1 : mass delete Salesforce Flow versions

caleksiev

Updated: Sep 21, 2023


SCENARIO:

You want to delete a custom field, but the field is referenced in too many places, including 20+ or 30+ obsolete flow versions.


NORMAL SOLUTION:


You go to the flow versions and start deleting them one by one, until all references from the field are gone and you are able to delete the field.


THE SALESFORCE HACK WAY:

and enter the following Query


SELECT 
    DurableId, 
    FlowDefinitionView.Label, 
    VersionNumber, 
    Status 
FROM 
    FlowVersionView 
WHERE 
    FlowDefinitionView.Label 
        LIKE '%PLACE PART OF THE FLOW NAME HERE%' 
AND 
    Status != 'Active'

*I wrote the query like that for better visibility purpose, here's the one-liner

SELECT DurableId, FlowDefinitionView.Label, VersionNumber, Status FROM FlowVersionView WHERE FlowDefinitionView.Label LIKE '%PLACE PART OF THE FLOW NAME HERE%' AND Status != 'Active'

Of course, change the part

 '%PLACE PART OF THE FLOW NAME HERE%'

with your desired flow label.


*If you want to see all the versions of your flow, remove the last part

AND Status != 'Active'

Once you have all the versions of the flow, click 'Copy (Excel Format) ' or at least this is the most commonly used format and in your Excel sheet, change the 'DurableId' to just 'Id'.

Copy only the column values + header of that Id column


Now, head back to Salesforce Inspector Reloaded and click 'Data Import'.

- mark 'Use Tooling API'

- Action 'Delete'

- Object 'Flow'

- Data: Ctrl + V on 'Paste EXCEL data here' with the copied data from previous step

- Batch size '1'

- Threads '1'

*If you decided NOT the change the header from DurableId to just Id, now is the time to change it on the Data Import screen, on the right 'Field Mapping' window :)



*I am using Batch size 1 and threads 1, because I have faced some issues when I used this approach some time ago, but just be informed that Batch size must be maximum 10 and threads can be 1 to 6 inclusive. If you try with Batch size greater than 10, you will get an error:


Thank you, Steven Trumble ( https://www.linkedin.com/in/steven-trumble/ ) for pointing me to the right direction in regards to the Batch size :)

Click 'Run Delete' and you will have all the flow versions deleted in a matter of seconds without any tedious clicking around!

Now, go and delete that custom field!!! :)

3,109 views0 comments

Recent Posts

See All

Commentaires


Proudly created with Wix.com

bottom of page