CRT-450 Exam QuestionsBrowse all questions from this exam

CRT-450 Exam - Question 147


A developer must create an Apex class, ContactController, that a Lightning component can use to search for Contact records. Users of the Lightning component should only be able to search for Contact records to which they have access.

Which two will restrict the records correctly? (Choose two.)

Show Answer
Correct Answer: BD

To ensure that the users of the Lightning component can only access Contact records to which they have access, we need to enforce sharing rules. The 'public with sharing' keyword ensures that the sharing rules for the current user are respected, meaning the user will only see records they have access to. The 'public inherited sharing' keyword means the class will inherit the sharing rules from the class that called it, ensuring that sharing rules are still enforced as per the caller's context. Both of these options ensure that only accessible records are returned, making them the correct choices.

Discussion

3 comments
Sign in to comment
thneebOptions: BD
Dec 17, 2022

B + D is correct https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_keywords_sharing.htm

SanjeevOnForceOptions: AB
Nov 1, 2023

By default the class used the with sharing. So it's A,B

SS1121Options: BD
Jun 20, 2024

BD is correct