Loading

Unable to Deactivate Salesforce User Due to Custom User Hierarchy Field — Use Data Loader to Clear Field Values

Julkaisupäivä: Jul 10, 2026
Kuvaus

When you attempt to deactivate a User in Salesforce, you may encounter the following error: 

"Cannot complete this operation. Cannot inactivate user that is the value of a hierarchy field: User Hierarchy. : Jane Doe"


This error occurs when the user you are attempting to deactivate is still referenced as the value of a custom User Hierarchy field in another user record (in this example, Jane Doe's record). Salesforce prevents deactivation of users who are referenced in hierarchy fields to maintain data integrity.  For background on why this restriction exists, review the Considerations for Deactivating Users documentation.


The embedded video provides an overview of deactivating users in Salesforce, including common errors encountered and recommended steps for resolving them before proceeding with deactivation.

Ratkaisu

If deleting or removing the custom User Hierarchy field is not possible, you can use Salesforce Data Loader to bulk-clear the field value for all users who reference the target user in the hierarchy field. Once cleared, you can deactivate the original user as intended.

Step 1: Export Affected Users

  1. Launch Data Loader and select Export.
  2. Log in to the organization.
  3. Select the User object and a file location for the extraction.
  4. Click Next, then Yes.
  5. Select the fields: ID, First Name, Last Name, the custom Hierarchy field, and any other identifying fields.
  6. Add a filter condition: Field = the custom Hierarchy field | Operation = Equals | Value = the ID of the user you want to deactivate. The resulting SOQL query looks like this: "Select FirstName, Id, LastName, User_Hierarchy__c FROM User WHERE User_Hierarchy__c = '0051P00000XXXXX'". Replace '0051P00000XXXXX' with the actual User ID.
  7. Click Finish, then Yes, and open the extracted CSV file.

Step 2: Clear the Hierarchy Field Values

  1. In the exported CSV file, delete all values in the custom Hierarchy field column for every row.
  2. Save the modified file as a new CSV file (retain the original as a backup).

Step 3: Update Records in Data Loader

  1. Return to Data Loader and click Settings, then Settings again.
  2. Check Insert null values and save. This allows Data Loader to write empty (null) values to the field.
  3. Click Update and select the User object.
  4. Select the new CSV file you just saved.
  5. Click Next, then OK.
  6. Click Create or Edit a Map and map only the ID and the custom Hierarchy field.
  7. Click Next, then Finish.

Once the update completes, the custom Hierarchy field is cleared for all affected users and you can deactivate the original user.

Knowledge-artikkelin numero

000384962

 
Ladataan
Salesforce Help | Article