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
AmbujAmbuj 

Opportunity not updating even when the responsible method is invoked

Hi There, Scenario: I have a visualforce page which has a button 'Approve'. On clicking the button; there is a field 'Status' on a custom object 'Approver'(It is a detail object to Opportunity) and a field 'Approval Status' on Opportunity object which gets updated as is written on the corresponding method in the associated controller. Question: I logged in as a user which has access to both the the master and the detail object records and clicked on the 'Approve' button to find both fields are updated. This is fine and expected. Now I logged in as a user who DO NOT has the access to both the master and the detail object records and click on the 'Approve' button to find that the detail object gets updated but the master object do not !!!! Kindly suggest and let me know if the access is necessary then why the detail object record was updated without the user having the access to it and not the master object record?
phiberoptikphiberoptik

You might want to delete this and repost it in the correct forum. This is the Formula and Validation Rules discussion forum. I believe you might want to repost in one of the development forums.

jungleeejungleee

Hi ,

 

Apex classes always runs in God mode a.k.a System mode. So it ignores all the Field level security. But if you add the with Sharing Keyword in the class, the class respects the sharing rules..

 

-Sam