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
Phuc Nguyen 18Phuc Nguyen 18 

Page fields read only based on logged in user

Hello All,
I was wondering, from a previous post I was using a VF page and aura compont and trying to control field access based on the logged in user.  Is this easier to accomplish in a lightning web component?  I see examples of gettign the logged in user infor but was wonder if I could grab the logged in users Name and  compare it to a picklist field.  If the user and picklist value matches they can edit certain fields.  Else its read only.  I know there is a readonly property on the input field but how can I make that a condiiton based on the logged in user(compare to picklist value).  Or if you have another way to accomplish this let me know.

Thank you,
P
ANUTEJANUTEJ (Salesforce Developers) 
Hi Phuc,

I found the below article link that suggests on how to check the field level security on visualforce page I hope this helps: 

>> https://www.biswajeetsamal.com/blog/check-object-level-and-field-level-security-within-a-visualforce-page/

However, generally speaking, development of lightning component in conjunction with lightning data services might help as lightning components alone does not support FLS while lightning data services support FLS. [https://www.forcetalks.com/salesforce-topic/how-to-ensure-fls-while-working-with-lightning-component/#:~:text=FLS%20and%20CRUD%20are%20not,users%20do%20not%20have%20access.]

I hope this helps.

Regards,
Anutej