deleting inactive flow versions using agentforce vibes

using this approach from sfse, in agentforce vibes

  1. log in to vibes
  2. create a new text file directly in the root folder. in my example i named it rmflow.sh
  3. enter the script into the file. i havent figured out how to get $USERNAME to work in vibes, so i just hard code my username
sfdx force:data:soql:query --query "SELECT Id FROM Flow WHERE Status != 'Active' AND  Definition.NamespacePrefix = '' " --target-org gsethXXX@XXX.org.dev --use-tooling-api --result-format csv > flowTodelete.csv

while read c; do
    if [[ "$c" != "Id" && "$c" != "Your query returned no results." ]]
        then
            sfdx force:data:record:delete --sobject Flow --record-id $c --target-org gsethXXX@XXX.org.dev --use-tooling-api
    fi
done < flowTodelete.csv

rm flowTodelete.csv
  1. in terminal, type chmod +x rmflow.sh (this makes the file executable)
  2. type ./rmflow.sh (this runs the script)

it will delete the inactive flows (and process builders for you geezers) one at a time…

Screenshot 2026-07-30 152345.png

vibes now sensibly only launches from sandboxes. so to do this for prod, you need to authenticate to prod from a sandbox, and update your username in the script.

 
0
Kudos
 
0
Kudos

Now read this

101 little things to make salesforce a lot better

A sporadically maintained list of coal seams smoldering deep in the caverns of salesforce.com that cause needless liver damage in many an awesome admin. In honor of summer19, this post now has the subtitle of: 101 things that might be... Continue →