New Year Sale 2026! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

Salesforce DEX-450 Exam - Topic 9 Question 123 Discussion

Actual exam question for Salesforce's DEX-450 exam
Question #: 123
Topic #: 9
[All DEX-450 Questions]

While developing an Apex class with custom search functionality that will be launched from a Lightning Web Component, how can the developer ensure only records accessible to the currently logged in user are displayed?

Show Suggested Answer Hide Answer
Suggested Answer: A

Contribute your Thoughts:

0/2000 characters
Filiberto
15 days ago
I remember something about using `UserInfo.getUserId()` to filter records, but I can't recall the exact implementation details.
upvoted 0 times
...
Arthur
20 days ago
I think we need to use the `with sharing` keyword in the Apex class to enforce sharing rules, but I'm not entirely sure if that's enough.
upvoted 0 times
...
Lamonica
25 days ago
I've done something similar before. I'd use the WITH SECURITY_ENFORCED clause in the SOQL query to automatically apply the user's permissions. Should be a straightforward fix.
upvoted 0 times
...
Pamella
1 month ago
This seems tricky. I'll need to research how to properly handle user permissions in an Apex class that's called from a Lightning Web Component. Might take some time to figure out the right solution.
upvoted 0 times
...
Tyra
1 month ago
Okay, I think I've got a plan. I'll use the System.UserInfo class to get the current user's ID, then build a dynamic SOQL query to only return records they have access to.
upvoted 0 times
...
Thora
1 month ago
Hmm, not sure about this one. Probably need to leverage the user context in the Apex class somehow, but not totally clear on the best approach.
upvoted 0 times
...
Vilma
2 months ago
I'd start by checking the user's permissions and querying the records accordingly. Might need to use a SOQL query with appropriate filters.
upvoted 0 times
...

Save Cancel