You need to sign in to do that
Don't have an account?
Developer Base
With sharing/Without sharing class called from Trigger
Hello,
trigger always runs in system mode.
https://salesforce.stackexchange.com/questions/172060/types-of-execution-system-mode-or-user-mode
But what if the trigger calls a method from a class which has "with sharing" or "without sharing defined"?
I did my own tests and it seems that if the method is called from a trigger, even the method executes in system mode, so it does not matter if it is "with" or "without sharing", once it is called from a trigger, it always runs in system mode.
Yes or no?
trigger always runs in system mode.
https://salesforce.stackexchange.com/questions/172060/types-of-execution-system-mode-or-user-mode
But what if the trigger calls a method from a class which has "with sharing" or "without sharing defined"?
I did my own tests and it seems that if the method is called from a trigger, even the method executes in system mode, so it does not matter if it is "with" or "without sharing", once it is called from a trigger, it always runs in system mode.
Yes or no?
You are right
Please have a look on below points:-
if you need any assistanse, Please let me know!!
Kindly mark my solution as the best answer if it helps you.
Thanks
Mukesh
All Answers
You are right
Please have a look on below points:-
if you need any assistanse, Please let me know!!
Kindly mark my solution as the best answer if it helps you.
Thanks
Mukesh
so regarding triggers it does not make any sense to put "with sharing" or "without sharing" in the class methods whih are called from the trigger, yes? They will always run in system mode like the trigger does.
And second question: When does it make sense to use "With sharing" or "without sharing" ? For example when using custom controllers, custom buttons and so on?
Thanks