Loading

Mass delete 'Portal' roles with Data Loader

Veröffentlichungsdatum: Jun 22, 2026
Beschreibung

When Salesforce Experience Cloud (Portal) users are deactivated or no longer needed, the associated Portal roles may accumulate in the org. These Portal roles cannot be deleted individually through the Setup UI. Salesforce Data Loader (Apex Data Loader) can be used to export and mass delete Portal roles.

WARNING: Deleted roles cannot be undeleted. Always test in a sandbox before performing this operation in production.

Lösung

Step 1: Export Portal Roles Using Data Loader

 

 

Use Data Loader to first export all Portal roles so you can review them before deletion.

  1. Launch and login to Data Loader.
  2. Click the Export button.
  3. Select Show all Salesforce objects.
  4. Select Role (UserRole).
  5. Click the Select all fields button under 'choose the query fields below.'
  6. Under 'create the where clauses to your query below' select PortalType as the field.
  7. Select not equals as the operation.
  8. Select None as the Value.
  9. Click the Add Condition button.
  10. Click the Finish button.

Step 2: Review the Export File

 

 

Open the exported CSV file. If any rows show 'None' in the PortalType column, those are standard user roles (not Portal roles) — restart and correct the WHERE clause. Only proceed once the file contains only Portal roles you wish to delete.


Step 3: Delete Portal Roles Using Data Loader

  1. Load and login to the Apex Data Loader.
  2. Click the Delete button.
  3. Select Show all Salesforce objects.
  4. Select Role (UserRole).
  5. Choose your modified/reviewed .csv file (the export) and click Next.
  6. Click the Create or edit a Map button.
  7. Map the Id.
  8. Click Ok.
  9. Click Next to proceed. Finish.
 
 
Warning: always back up your data before any data operation. Deleted roles cannot be undeleted or recovered.

Note: You might hit an error of "Your attempt to delete the role <rolenamehere> couldn't be completed because Users are currently assigned to that role or at least one role reports to that role. If you do see this error, you'll need to reassign any Users to a new partner role before you can complete the deletion. 



Nummer des Knowledge-Artikels

000381993

 
Laden
Salesforce Help | Article