Salesforce: One critical impact to check before deleting a Role

Key impact to check before deleting a Role

Before deleting a role from a Salesforce org, the most critical impact to verify is how role-based sharing rules and role hierarchy affect record visibility. Deleting a role can unexpectedly remove record access for users, break sharing rules that reference the role, and change visibility in reports and dashboards.

Why this matters

Salesforce uses roles to model the organization’s hierarchy and to control data access. Many declarative and programmatic mechanisms—sharing rules, manual shares, Apex-managed sharing, reports, dashboards, and some flows—can explicitly reference a role. Removing the role without planning can lead to data exposure issues or cause users to lose access to records they need.

How to check (quick checklist)

Follow these steps to evaluate the impact before deleting:

1. Identify the Role Id and users assigned to it:

SELECT Id, Name FROM User WHERE UserRoleId = '00Exxxxxxxxxxxx'

2. Find records owned by those users (example for Account):

SELECT Id, Name, OwnerId FROM Account WHERE OwnerId IN ('005xxxxxxxxxxxx','005yyyyyyyyyyyy')

3. Review Sharing Rules and Manual Sharing:

– Go to Setup → Sharing Settings → review any sharing rule that grants access based on Role or Role and Subordinates.

– Check for manual shares on records owned by users in this role.

4. Search metadata for references to the role name or Id:

– Check Flows, Apex code, custom metadata, and automation that might use the role for logic or sharing.

5. Inspect Reports, Dashboards and Queue Memberships:

– Ensure reports or dashboard filters referencing role-based visibility won’t break. Also check if the role is used to grant queue memberships or other permissions.

Mitigation steps

– Reassign users to a different role before deleting.

– Replace role-based sharing rules with public groups or criteria-based sharing if appropriate.

– Update automation and Apex that refer to the role (or use Public Groups / custom metadata instead).

– Run a visibility audit (impersonate users or use the “View All Users” sharing debug tools) after changes.

Summary

In short: check role-based sharing rules and role hierarchy impact on record visibility as your primary item before deleting a role. This single check helps prevent accidental loss of access, broken automations, and reporting issues.