Pages

Sunday, January 23, 2022

Salesforce: Mass Update Role Hierarchy Access

In a blog written many years back, I shared sharing access from role hierarchy, which is about to give access to the Account owner for the Contact/Opportunity/Case records that related to the Account, but is not owned by Account Owner.


That access information is stored in the UserRole object, and you can mass update the access by simply updating the records in the UserRole object.

A sample query
SELECT Id, Name, ParentRoleId, DeveloperName, RollupDescription, ContactAccessForAccountOwner, OpportunityAccessForAccountOwner, CaseAccessForAccountOwner FROM UserRole WHERE PortalType = 'None'

A few fields are worth knowing from the above query:

- PortalType = None: Salesforce application role, CustomerPortal: Customer portal role, Partner: partner portal role.

- RollupDescription, this is "Role Name as displayed on reports", so it can be different with the actual Role Name.


Reference:




No comments:

Post a Comment

Page-level ad