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
Ben Affleck-CurrieBen Affleck-Currie 

User interface field/object permissions don't align with code permissions, also can't enable "Modify All Data" permission

Hi, I was told to post this issue here after contacting Salesforce Support in the usual way.
-----

What happened?:
We're working with a customer and they've installed one of our products from the AppExchange. This package contains a collection of custom objects and fields, as well as some Apex Classes and Triggers. Our package relates to Opportunities and Opportunity Products, via a custom Revenue Schedules object.

When logged in as a system administrator with the "Modify All Data" permission, everything works correctly (as expected). The Revenue Schedules change, which updates the Opportunity Product information as expected (Sales Price and Total Price specifically).

When logged in as another user in the system with a different profile, they are unable to trigger an update on the Opportunity Product despite having full access to the object and the fields. All necessary fields are read/write and the object access is correct. When logged in as another user, I am also able view the record I need to edit, so I am absolutely certain these is no access issue. When our code triggers, the update to the Opportunity Product object never occurs, and we can't understand why.

We attempted to add the "Modify All Data" permission to a different profile for testing and debugging, but we are also unable to save this permission.

Our app works perfectly for all users in other environments with exactly the same configuration.

Expected Outcome:
When a user manipulates the custom Revenue Schedules object records, the Opportunity Product Sales Price and Total Price should change and the Opportunity Amount should update. This is only working for System Administrators, no other users.

Error Messages:
There is no error message, instead, the process is bypassed unexpectedly.

Does anyone have any idea as to why this issue might be occurring?
ankit bansalankit bansal
Hi Ben Affleck(Never thought I would be corresponding with Batman :)),
The issue seems because of incorrect record access, does your package add sharing rules. Is your class running in with sharing,without sharing , default sharing, inherited sharing. What is the entry point of execution of your code. Since opportunity product is a detail record of opporunity it's sharing is controlled by the parent opportunity. 
User-added image
Can you see if you have atleast read access on the opportunity. Can you get debug logs from you managed package and see of the query is returning the opporunity line items and the DML is successful or not. If any exception is being caught which you have not logged correctly.

Thanks.