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?
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?
The error occurred because the trigger handlers class does not use any sharing keywords and the user does not have access to the orders related to the opportunity. In an Apex class, if no sharing keyword is specified, the class runs in system context which can bypass normal sharing rules. This means the user's permissions are not enforced, and if the user does not have access to create or view orders, they will encounter a permission error when the trigger attempts to create the related order.
i think D is the answer, because A end B are equivalent, default sharing is "With Sharing", and old related order not impact the creation of new one.
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
B might be right. With out sharing ignores sharing rules is the default model for Apex class
I think B is correct Because IsCreateable() just checks user access
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
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.
If it's be D, User won't be getting a message.