Metadata Type: SharingSet
SharingSet is a powerful metadata type in Salesforce that allows administrators to control data access for users in Customer Community Plus and Partner Community licenses. This research paper explores the functionality, deployment challenges, and best practices associated with SharingSet metadata.
Understanding SharingSet
SharingSet metadata enables administrators to define granular sharing rules based on user criteria, typically involving lookup fields such as Account, Contact, or User. This functionality was introduced in the Winter '19 release, significantly simplifying sharing configurations for community users.
Key Features
- Matches lookup fields from Community User to records in Salesforce org
- Supports complex sharing scenarios through conditional lookups
- Allows sharing based on Account Contact Relationships
- Applicable to multiple objects within a single sharing set
Deployment Challenges
While SharingSet offers robust sharing capabilities, administrators may encounter several challenges during deployment:
1. Simultaneous Sharing Calculations
Salesforce can only process one sharing calculation at a time. Attempting to update the externalSharingModel on multiple custom objects simultaneously can result in deployment failures.
2. Sharing Model Conflicts
Updating the sharingModel field for an object while adding a new owner-based sharing rule is not supported in the Metadata API, leading to deployment errors.
3. Limited Sharing Sets per Object
Only one sharing set can be applied per object for each profile, which may pose challenges when implementing complex sharing scenarios involving multiple user groups.
Best Practices for Salesforce Administrators
To maximize the effectiveness of SharingSet metadata and minimize deployment issues, administrators should adhere to the following best practices:
1. Staged Deployments
Deploy sharing changes for objects separately to avoid conflicts with simultaneous sharing calculations. This approach reduces the risk of deployment failures and allows for better control over the sharing recalculation process.
2. Optimize Sharing Rules
When implementing owner-based sharing rules, first set the org-wide default to public, then update the sharingModel. This ensures a single sharing recalculation rather than multiple calculations, reducing the likelihood of deployment errors.
3. Leverage Profile-Based Sharing Sets
Utilize different profiles for user groups with distinct sharing requirements. This allows for the creation of multiple sharing sets per object, each associated with a specific profile, enabling more granular control over data access.
4. Use Conditional Lookups
Implement "backend only" lookup fields on objects to create conditional sharing scenarios. Populate these fields using automation tools like Process Builder to achieve more complex sharing logic within a single sharing set.
5. Account for Related Accounts
Enable sharing based on Account Contact Relationships to handle complex account hierarchies and one-off sharing scenarios outside the primary account structure.
6. Regular Maintenance
Periodically review and optimize sharing sets to ensure they align with evolving business requirements and maintain optimal system performance.
Conclusion
SharingSet metadata provides Salesforce administrators with a powerful tool for managing data access in community environments. By understanding its capabilities, potential deployment challenges, and following best practices, administrators can effectively implement and maintain robust sharing configurations that meet complex business needs while ensuring data security and user productivity.