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
Srinu@dreamsSrinu@dreams 

Try to access info. form sObj for which don't have permissions for user using trigger

* There are two sObjects A and B.

* For A sobject user has access, For B he dont have access.

* If he write a Trigger on A sobject which intern want to access B sObject What will happen

Best Answer chosen by Admin (Salesforce Developers) 
bob_buzzardbob_buzzard

Triggers run in the system context (unless you hand over to a class decorated as 'with sharing') so I'd expect the trigger to be able to access object B as long as the user's license type covers that object.

All Answers

bob_buzzardbob_buzzard

Triggers run in the system context (unless you hand over to a class decorated as 'with sharing') so I'd expect the trigger to be able to access object B as long as the user's license type covers that object.

This was selected as the best answer
Srinu@dreamsSrinu@dreams

Is it possible to write trigger inside an apex class?

bob_buzzardbob_buzzard

No, you'd need to write the trigger in its own file, but that can simply hand over to an apex class.