The Problem
If you are trying to delete a field, Salesforce will not allow you to deploy this deletion if the field is referenced in any flow in the target -- even in any deactivated older flow versions.
Let's imagine you have a Flow A that references Field B. You want to delete Field B, so you:
Create a new version of Flow A that removes the reference to Field B.
Delete the previous versions of Flow A that reference Field B.
Delete Field B itself.
If you now select the changed Flow A and deleted Field B for deployment, you will face the following validation error:
The manual resolution to this error is to delete the flow versions from the target environment before attempting to deploy the field deletion. However, this requires updating environments directly, and lacks a robust audit trail.
The approach detailed below is likely to work with other metadata types used in Flows too (such as Apex), but reach out to us in the chat if you have any questions!
How to resolve this with Gearset Pipelines
Gearset's Pipelines will automatically validate your PR and return the same failed error message from Salesforce. If you have deployment access to the target environment, you can then use the "manually resolve" option to split this deployment into steps Salesforce will accept:
Deploying the changed flow
Deleting the previous flow versions
Select "manually resolve" on the PR again, and this time change the comparison API version to API version 43 or below (which will allow you to retrieve all flow versions)
In the comparison, select all previous versions of the flow -- these should all show as deletions. Make sure not to select the latest version as you will then delete the flow entirely from the target!
Deploy the older versions of the flow to delete them from the environment
Deploying the field deletion
As the flow versions have now been deleted, you can re-run the validation of the PR and this should now succeed. You can then merge the PR as normal, which will delete the field from the target
How to resolve this with Gearset Compare & Deploy
If you are using Gearset's org to org comparison, you can also delete a field referenced by older flow versions by following these steps:
Deploying the changed flow
Run a comparison with the changed flow. Ensure the latest flow version is set to active. Deploy just this changed flow
Deleting the previous flow versions
Run another comparison, but this time change the comparison API version to API version 43 or below (which will allow you to retrieve all flow versions)
Select all previous versions of the flow -- these should all show as deletions. Make sure not to select the latest version as you will then delete the flow entirely from the target!
Deploying the field deletion
As the flow versions have now been deleted, you can now run a final comparison to select the deleted field. Deploy the deleted field, and you're done!




