Skip to Content

Salesforce Certified Platform Developer II: Granting Read-Only Access to Defect Records for Reviewers in Salesforce

Learn how to provide read-only access to Defect records for Users on Reviewer records using Apex managed sharing in Salesforce. Ensure proper access control and streamline the defect review process.

Table of Contents

Question

A software company uses a custom object, Defect__c, to track defects in their software. Defect__c has organization-wide defaults set to private. Each Defect__c has a related list of Reviewer__c records, each with a lookup field to User that is used to indicate that the User will review the Defect__c.

What should be used to give the User on the Reviewer__c record read only access to the Defect__c record on the Reviewer__c record?

A. Apex managed sharing
B. View All on Defect__c
C. Lightning web component
D. Criteria-based sharing

Answer

D. Criteria-based sharing

Explanation

Criteria-based sharing allows you to create sharing rules based on specific criteria, such as the values of fields on the record. In this case, you can create a criteria-based sharing rule on the Defect\_\_c object that grants read-only access to Users who are listed on the related Reviewer\_\_c records.

Here’s how you can set up the criteria-based sharing rule:

  1. Create a new sharing rule for the Defect\_\_c object.
  2. Set the rule type to “Criteria-Based Sharing Rule.”
  3. Specify the criteria for the rule, such as “Reviewer\_\_c.User\_\_c NOT EQUAL TO null.” This ensures that the sharing rule applies to Defect\_\_c records that have related Reviewer\_\_c records with a User specified.
  4. Set the access level to “Read Only.”
  5. Save the sharing rule.

With this criteria-based sharing rule in place, Users who are listed on the Reviewer\_\_c records will automatically gain read-only access to the associated Defect\_\_c records, even though the organization-wide defaults for Defect\_\_c are set to private.

The other options are not suitable for this scenario:

  • Apex managed sharing (A) is used when you need to programmatically create, update, or delete sharing records using Apex code. It’s not the most efficient solution for this case.
  • View All (B) is a permission that allows users to view all records of a particular object, regardless of sharing settings. It’s not granular enough to grant access based on the specific criteria of being listed on a Reviewer\_\_c record.
  • Lightning web components (C) are used for building custom user interfaces in Salesforce and do not directly handle record access control.

Therefore, criteria-based sharing (D) is the most appropriate solution to grant read-only access to Defect\_\_c records for Users listed on related Reviewer\_\_c records.

Salesforce Certified Platform Developer II certification exam practice question and answer (Q&A) dump with detail explanation and reference available free, helpful to pass the Salesforce Certified Platform Developer II exam and earn Salesforce Certified Platform Developer II certification.