SHARING-AND-VISIBILITY-DESIGNER practice question 4 of 30
Universal Containers has a private sharing model on Accounts. Apex Managed Sharing is required to share certain account records with all users who are assigned to a specific Role in the Role Hierarchy. What should be the recommended way for the Architect to implement this?
Full set: 212 questionsThe most scalable and maintainable method to implement this requirement is to create a public group that contains the specified Role. Then, use Apex to create a single AccountShare record for each Account to be shared, setting the UserOrGroupId to the ID of this public group. This approach is efficient because it requires only one share record per Account, regardless of the number of users in the role. It is also maintainable, as any changes to the role's user membership are automatically reflected in the group's membership without any further administrative effort.
A. A public group containing individual users is not maintainable. As users change roles, the group membership would need to be updated manually.
B. Creating a share record for each user is not scalable and can lead to performance issues and hitting sharing limits, especially with many users or records.
C. Sharing directly to a Role ID is possible, but it does not grant access to users in subordinate roles. Using a group provides this flexibility if needed.
1. Salesforce Developers, Apex Developer Guide, "Sharing a Record Using Apex". This guide details how to create Share objects, specifying the UserOrGroupId which can be a User ID or a Group ID.
2. Salesforce, Sharing and Visibility Designer Study Guide, "Programmatic Sharing" section. Best practices emphasize using groups for sharing to simplify management and improve performance. It states, "Share to a public group or role whenever possible to reduce the number of records and improve performance."
3. Salesforce Help, Create and Edit Groups. This document explains that public groups can contain roles, roles and subordinates, or other groups, which is the foundation for this scalable sharing pattern.
Keep practicing
Take the free SHARING-AND-VISIBILITY-DESIGNER practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other SHARING-AND-VISIBILITY-DESIGNER practice questions
- Question 1Universal Containers is a fast-growing company that sells containers globally. It has tho…
- Question 2Universal Containers uses 75,000 distributors that have close to 1 million total users. D…
- Question 3Universal Containers would like to create a custom team solution that can be used on a cu…
- Question 5Universal Containers keeps product brochures in Salesforce as files. Sarah shares a publi…
- Question 6What is the best practice for testing sharing and visibility changes?
- Question 7Besides their own team accounts, sales managers at Universal Containers need to have READ…
