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:
Thanks to Thomas Prouvot ( https://www.linkedin.com/in/thomasprouvot/ ) , open Salesforce Inspector Reloaded ( https://chrome.google.com/webstore/detail/salesforce-inspector-relo/hpijlohoihegkfehhibggnkbjhoemldh ) Data Export option
![](https://static.wixstatic.com/media/4620a7_85dd6e470b2a464d8b071893e79cd45e~mv2.png/v1/fill/w_379,h_561,al_c,q_85,enc_auto/4620a7_85dd6e470b2a464d8b071893e79cd45e~mv2.png)
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
![](https://static.wixstatic.com/media/4620a7_5d8d8f2654a546a2a2cb1bc8fe4e0e6a~mv2.png/v1/fill/w_503,h_556,al_c,q_85,enc_auto/4620a7_5d8d8f2654a546a2a2cb1bc8fe4e0e6a~mv2.png)
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'
![](https://static.wixstatic.com/media/4620a7_54c48afda1d04d2d8412e4509c8cb161~mv2.png/v1/fill/w_980,h_587,al_c,q_90,usm_0.66_1.00_0.01,enc_auto/4620a7_54c48afda1d04d2d8412e4509c8cb161~mv2.png)
*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 :)
![](https://static.wixstatic.com/media/4620a7_4a153e96572e458896d9a18398da81c3~mv2.png/v1/fill/w_948,h_334,al_c,q_85,enc_auto/4620a7_4a153e96572e458896d9a18398da81c3~mv2.png)
*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:
![](https://static.wixstatic.com/media/4620a7_ea391bee10b44aab8db8f0fa5968be90~mv2.png/v1/fill/w_980,h_326,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/4620a7_ea391bee10b44aab8db8f0fa5968be90~mv2.png)
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!!! :)
Commentaires