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
shrey.tyagi88@tcs.comshrey.tyagi88@tcs.com 

Grant Access to Fileds using Apex sharing- Please help!!

Hi Everyone,
       I am looking for a solution for the following problem.

 

There is an object called "Test Object". It has 13 fields in total. Let's annotate them F1-F10 (ALL CHECKBOXES)  and U1-U3 (All user lookups).

OWD: Public Read/Write
All Profiles (except Admin): Read Only on Record and only F1-F5 are visible, F6-F10 are hidden.
Super User: Read/Write (using permission set on all fields F1-F10 AND U1-U3)

Now as per the requirement, whenever the super user edits a record and adds U1,U2,U3 to it 2 things should happen:

1. U1,U2,U3 should get Read/Write on Record (done this by Apex sharing).
2. U1,U2,U3 should get access to all fields : Specially F6-F10 that are hidden by default due to profiles.

Is there a way to show fields (that are hidden at profile level) to U1,U2 and U3 only  on a record by record basis.

Please let me know. Thanks.