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.
Step 1: Export Portal Roles Using Data Loader
Use Data Loader to first export all Portal roles so you can review them before deletion.
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 LoaderNote: 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.
See also:
Download and activate Data Loader
Export Backup Data from Salesforce
000381993

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.