Explanation of the error
You may come across this Salesforce validation error when you're validating or deploying changes to an approval process:
βYou can't delete this approval process because records were submitted for approval and haven't completed the process.
This is expected Salesforce behaviour. Salesforce locks any record that has been submitted for approval and is still pending in that process, and it won't allow the approval process to be deleted while those submissions are in flight.
β
More information in Salesforce's documentation:
βConsiderations for Managing Approvals
Resolution
In the target org (the org you're deploying to):
Find the records still pending in the approval process. The Approval History related list on each record, or
Setup β Approval Processes, will show the in-flight requests.Clear those pending submissions to release the record locks: either have the assigned approvers approve/reject them, or use Recall Approval Request on the record's Approval History related list to withdraw them.
Once no records remain pending in the process, re-run the validation/deployment in Gearset.
There may also be records in the Recycle Bin, you'll need to empty that too.
The above should allow you to successfully deploy your changes to the approval process.
Disclaimer: This error is returned directly by Salesforce, 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.

