Skip to content

Profile referenced elsewhere

Detection

  • RegExp: Error (.*) This profile is referenced elsewhere in Salesforce

Examples

  • Error Old_Sales_Profile This profile is referenced elsewhere in Salesforce. Remove the usage and try again.

Resolution

Profile {1} can not be deleted while something uses it in the target org (users, a Login Flow, a Connected App...).
- Assign its users to another profile, and remove the other usages 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 "Free profile {1} before its deletion" --instructions "1. In Setup, open Users, and give another profile to the users of {1}
2. Check that no Login Flow and no Connected App uses {1}
3. If no user has {1} anymore, there is nothing to do"

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

Comments