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
javierjiesjavierjies 

issue with sharing

Hello everyone!

 

Using an Appex trigger we like to add a record in sharing table. The user who update the record that trigger the appex is not the owner so the trigger fail.

We would like to know is it possible to run a trigger from the owner of the record despite the user that modify the record that trigger "the trigger" had only read/write access.

 

 

 

Regards. 

Susana NTSSusana NTS

Hi Javier,

 

Since Apex Triggers are run as an Admin User you should not have that problem you are explaining.

Anyhow, I think you could use the System.runAs(<userId>){} method to run the code as the user you want to.

 

Good luck.

 

Cheers,

 

Susana 

Susana NTSSusana NTS

Sorry, I mixed up everything.

 

Just give a try to the System.runAs() and see what happens

metaforcemetaforce

System.runAs() can be used in test methods only.

 

Can you post the exact error message that you receive on trigger failure?

Message Edited by metaforce on 01-21-2010 05:19 AM