Skip to content

Approval process with pending records

Detection

  • String: You can't delete this approval process because records were submitted for approval

Examples

  • Error Invoice__c.Invoice_Approval You can't delete this approval process because records were submitted for approval and haven't completed the process

Resolution

Records are still waiting in this approval process in the target org.
- Approve, reject or recall the pending records in the target org, then run the job again
- The manual deployment action below reminds to do it in each org of the pipeline, with a checkbox in the Pull Request comments

Deployment action

A deployment action can solve this error. Create it on the Pull Request of the current branch:

sf hardis:project:action:create --agent --scope pr --pr-id current --when pre-deploy --type manual --label "Close the pending requests of the approval process" --instructions "1. In the target org, open the Items to Approve list, or a report on Process Instances, filtered on this approval process
2. Approve, reject or recall each pending request
3. If no request is pending, there is nothing to do"

Documentation: https://sfdx-hardis.cloudity.com/salesforce-devops-work-on-user-story-deployment-actions-manual/

Comments