Skip to content

Instantly share code, notes, and snippets.

@jkentjnr
Created October 3, 2024 23:07
Show Gist options
  • Save jkentjnr/cfa8fedccdd177e9a003ddedff4342d6 to your computer and use it in GitHub Desktop.
Save jkentjnr/cfa8fedccdd177e9a003ddedff4342d6 to your computer and use it in GitHub Desktop.
Salesforce_Bash_Scripts
# https://salesforce.stackexchange.com/questions/275679/remove-all-old-flow-versions-using-sfdx
sfdx force:data:soql:query --query "SELECT Id FROM Flow WHERE Status = 'Obsolete'" --target-org $1 --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 $1 --use-tooling-api
fi
done < flowTodelete.csv
rm flowTodelete.csv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment