function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
VSK98VSK98 

I want to run Trigger in User mode

Hi All,

As per my knowledge Trigger is running System mode. But i wanna run in User Mode. How?

Regards,
VSK 98
Balasubramaniam 07Balasubramaniam 07
Hi 

Create Apex class with 'WithSharing' enforced and invoke the class from trigger. This will enforce Shariing settings based on user.

Thanks
Bala
VSK98VSK98
Hi Sohel,

I am little bit confusion with your answer. I need to know two points.
1. Why did u add System Adminstrator here and
2. Can't use with sharing in triggerhandler class

Please let me know. Your revert is most valuable :)

Regards,
VSK98
 
Balasubramaniam 07Balasubramaniam 07
Hi,

you can call the isAccessible, isCreateable, or isUpdateable methods of Schema.DescribeSObjectResult to verify whether the current user has read, create, or update access to an sObject, respectively. Similarly,Schema.DescribeFieldResult exposes these access control methods that you can call to check the current user's read, create, or update access for a field. In addition, you can call the isDeletable method provided bySchema.DescribeSObjectResult to check if the current user has permission to delete a specific sObject



Thanks,
BaLa