QuestionQ11

Programmatic Sharing

Universal Containers (UC) has a team that analyzes customer orders for fraud. The team requires access to Invoice records (a custom object with Private OWD). UC uses complex rules to control user access. The Salesforce Architect recommends Apex managed sharing to meet these requirements.

Which two recommendations should a Salesforce Developer consider when implementing these changes?

Choose two
  • A Use runAs system method to test different users accessing these records.
  • B Use “Without Sharing” keyword to make sure record visibility will be considered.
  • C Use “With Sharing” keyword to make sure record visibility will always be considered.
  • D Use “With Sharing” keyword to enforce field-level security.
Explanation

System.runAs lets Apex tests verify access while running as different users. Declaring the relevant Apex class with sharing enforces record-level sharing rules, including the access granted through Apex managed sharing. The without sharing keyword bypasses sharing rules, and with sharing does not enforce field-level security.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!