Tuesday, January 27, 2015

Understand Field's Visibility with Field-Level Security and Page Layout


We all know that Field-Level security (FLS) and Page Layout are very important concept. But let us understand the concept with multiple use cases. I always believe going through use cases/scenarios are the best way to learn the concept.

Use Case 1:
Object Name: Student
Field Name: Student Name
Field is required: Yes

Let’s try to change the field’s security both in profile level as well as through page layout.

Changing though Field Level Security @ Profile Level (say for profile: Sales User) –
You can’t change Field Level Security for a field if the field is marked as required during declaration. The field will become visible for all the profiles as shown below -
So is it possible to do something in page layout? Let’s check –
Seems like here also you can’t do any changes. Below is the screenshot –
So the conclusion is that if a field is marked as required during declaration, that field will remain required and visible in all the page layouts. You can’t make that field read-only also.

Use Case 2:
Object Name: Student
Field Name: Student Age
Field is required: No
Now we can have multiple scenarios. They are listed below –
Scenario 1:
Visible for Profile – Sales User: No
Visible for Profile – Executive User: Yes
Required in Page Layout - Yes
Observation:
Logged in as Adams, Karen (Profile – Sales User)
Logged in as Bassi, Brent (Profile – Executive User)

Scenario 2:
Visible for Profile – Sales User: Yes
Read Only for Profile - Sales User: Yes
Required in Page Layout - Yes

Observation:
Logged in as Adams, Karen (Profile – Sales User)
Scenario 3:
Visible for Profile – Sales User: Yes
Read Only for Profile - Sales User: No
Required in Page Layout - Yes
Observation:
Logged in as Adams, Karen (Profile – Sales User)

Scenario 4:
Visible for Profile – Sales User: Yes
Read Only for Profile - Sales User: No
Required in Page Layout - No
Read Only in Page Layout - Yes

Observation:
Logged in as Adams, Karen (Profile – Sales User)
Use Case 3:
Object Name: Student
Field Name: Student Age
Field is required: No
Visible for Profile – Sales User: No
Validation Rule in Student Object: 


Observation:
Logged in as Adams, Karen (Profile – Sales User)
So the conclusion is that validation rule still applies even if the field is set to not visible.

Hope now you can get better understanding of the how Field-Level Security and Page Layout works together. Any feedback, please let me know. Thanks.





1 comment: