Update roleAndSubordinates to roleAndSubordinatesInternal
Why is this an issue?
The default sharing group name has changed from "Roles and Subordinates" (roleAndSubordinates) to "Roles and Internal Subordinates" (roleAndSubordinatesInternal). Using the old name may cause sharing rules to fail, incorrect permission assignments or runtime errors when sharing records.
Examples
Example of incorrect code:
// Old sharing group name - deprecated
List<Account> accounts = [
SELECT Id, Name
FROM Account
WHERE OwnerId IN (SELECT Id FROM User WHERE Id = :managerUserId.roleAndSubordinates)
];
Example of correct code:
// New sharing group name
List<Account> accounts = [
SELECT Id, Name
FROM Account
WHERE OwnerId IN (SELECT Id FROM User WHERE Id = :managerUserId.roleAndSubordinatesInternal)
];
How can I fix violations?
This rule supports autofix. Additionally, you should:
Update references: Replace
roleAndSubordinateswithroleAndSubordinatesInternal.Search codebase: Find all occurrences in Apex, SOQL, and metadata.
Update sharing rules: Review and update any sharing rule configurations.
Resources
