How to make visualforce page readonly based on profile of the logged in user? I have a pageblock table of outputfield with inline editing, which is not working as read only when enabled readonly="true" in page attribute.
2 Answers
Try this, i had done below when read only needed to be false only if profile is System Admin or Outside developer
readonly={!IF(AND(NOT(CONTAINS($Profile.Name,'System Admin')),$Profile.Name!='Outside Developer'))}
Readonly attribute on visualforce page is beind used for increasing soql limit , it is not an actual readonly action. you dont need to additional customization for read only fields, if you are using inputfield on your visualforce page, it respects the profile permission setting, Make the related field readonly on the profile and visualforce makes the fields readonly for that profile.