Error overview
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.
Note: The approach detailed below is likely to work with other metadata types used in Flows too (such as Apex), but reach out to us via In-app chat if you have any questions!
How to resolve this in 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). Update the comparison
In the filter, make sure you have included the flow versions you would like to delete (either by selecting "All items" for the Flow metadata type, or explicitly selecting each flow version with "Specify named items and rules")
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 in Compare and deploy
If you are using Gearset's Compare and deploy (e.g. for org/Git to org deployment), 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!
Disclaimer: This error is returned by Salesforce directly, rather than Gearset. Even so, we offer guidance based on our combined experience with the Metadata API. Where possible, we try to help guide you to fix or avoid this error. In the case that this isn't possible, we may need to direct you to Salesforce support for further clarification.





