Child relationship name already used
Detection
- RegExp:
Error (.*) There is already a Child Relationship named (\S+) on (\w+)
Examples
Error Invoice__c.Account__c There is already a Child Relationship named Invoices on Account.
Resolution
A deleted field of the target org still holds the relationship name {2} on {3}: deleted fields stay 15 days in the org.
- Erase the deleted field in the target org before the deployment
- Or give another <relationshipName> to {1}
- 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 "Erase the deleted field that holds relationship {2} on {3}" --instructions "1. In Setup, open Object Manager, the object of the deleted field, then Deleted Fields
2. Click Erase next to the field whose relationship name is {2}
3. If no deleted field is listed, there is nothing to do"
Documentation: https://sfdx-hardis.cloudity.com/salesforce-devops-work-on-user-story-deployment-actions-manual/