Skip to content

Can not delete custom field

Detection

  • RegExp: Error (.*?) This .* is referenced elsewhere in salesforce.com
  • RegExp: Le champ personnalisé (.*) est utilisé dans (.*)

Examples

  • Error Account.Old_Field__c This custom field is referenced elsewhere in salesforce.com. : Apex Class - AccountService

Resolution

Custom field {1} can not be deleted while other items use it.
- Remove its references from your sources: sf hardis:project:clean:references --config manifest/destructiveChanges.xml removes every reference to the items listed there
- Items of the target org that are not in git (reports, list views...) must be updated in the org
THIS MAY BE A FALSE POSITIVE if you are only testing the deployment: destructive changes are checked separately from the rest of the deployment

Comments