+ Start a Discussion
Shailesh DeshpandeShailesh Deshpande 

Record getting created even when object is having only Read permissions

HI,

 

I have a object "Key Combination Lookup" to which i have given "Read only" permissions to other users .ie. users cannot create or edit a Key Combination Lookup record.

 

I have a trigger on Account. On insert of account, the trigger creates a Key combination lookup record. The relationship between the Account and Key Combination lookup is a Lookup relationship.

 

Now, when other users create an account, the trigger is creating a key combination lookup record. I dont understand why this is happening, since the users do not have create permissions on key combination lookup object. 

 

Is it that trigger is executing in system mode? 

 

Thanks,

Shailesh.

sfcksfck

Yes, the trigger will execute in system mode.

 

You could try making another class "with sharing", put your code in here, and call it from the trigger ... I haven't tried this myself, it's just a suggestion

Shailesh DeshpandeShailesh Deshpande

Ok.. But then what about the below case? I also have a vf page where a user can edit the Key Combination lookup record. In the controller of vf page, i am using the "with sharing" keyword. Should this not throw an error for users who only have read only permission? There are no sharing rules written for this object and the sharing model for this object is private.