After testing and deploying a new trigger that creates a related order when an opportunity is closed, the Architect begins receiving complaints of permission error messages appearing when closing an opportunity. How did this error occur?
A.
The trigger handlers class does not use any sharing keywords and the user does not have access to the orders related to the opportunity.
B.
The trigger handler class is using “with sharing” and the user does not have access to the orders related to the opportunity.
C.
The trigger should be using RunAs() when creating the order.
D.
Trigger is using IsCreateable() Apex method and the user doe not have create permission on the Order object.
B. is correct. ‘With Sharing’ enforces sharing rules and if that user doesn’t have related object access then access errors will occur. If sharing rules don’t deploy right, then it can be an issue only in prod.
A. Triggers run in system mode by default and will ignore sharing rules.
C. runAs() can only be used in test classes so it’s not relevant here
D. If user can’t create the object’s record, then it will return false. It immediately triggers an dml error bc the user can’t create. It would be caught before deployment and during testing.
B. Since isCreateable() returns true if the field can be created by the current user, false otherwise. Unless I read this wrong, there is no mention of a "field" in this question.
Don't think it is D, because if the trigger was using IsCreateable() to check for permissions before trying to create the Order, there shouldn't be any permission errors
I think D is the right answer. A and B are not relevant for the use case, because to create a new order it is not necessary to have access to already existing orders. And C it is just for test classes
upvoted 5 times
...
Log in to ExamTopics
Sign in:
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
roberto_ampl
Highly Voted 1 year, 6 months agosyuan0321
Highly Voted 1 year, 5 months agoBrainMelt12
Most Recent 2 weeks ago6967185
6 months agoRangya
10 months, 2 weeks agoNilesh_Nanda
1 year agoLiberPolly
1 year, 2 months agomariella_88
1 year, 5 months ago