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
Samuel StevensSamuel Stevens 

Understanding field level security/page layout required

I'm trying to better understand how field level security works with fields being required through page layouts. It seems there are 4 ways, you can make a field required:
1. When you create the field, you can tick the box to make it required
2. Through the page layout by clicking on the spanner/wrench next to the field
3.  Go to the object - Fields, click on the field name (not edit or del) and you can select "required"
4.  Go to Security Controls | Field accessiblilty, select the object, then the field and then you can edit through field access
What's confusing to me is field level security makes me think this is what you would use to make a field required, but it only allows you to select 'Visible' or 'Read'.

This came from trying to answer this question:
A custom field is made Read only from the Field level security and Required from Page layout. The Field will be?  
A. Read Only for the User

B. Required for the User
C. Throws an error and don’t allow to make Read only field Mandatory from page layout
D. User is given a choice in a pop-up window

The Quiz gave the answer as A, but I tested it and find the answer is B.
Would appreciate any input on whether i'm understanding all this accurately - thank you!
Samuel StevensSamuel Stevens
Also, meant to add that it also effects answering this question:
Which of the following is the best way to make the Field Mandatory for everyone?   
 A. Page Layout
 B. Validation Rule
 C. Roles & Profiles
 D. Field Level Security
I would select A or D. How would you decide which is "the best way"? I'm guessing it's asking about a field, so probably D. 
Any input appreciated - thank you!
I think the answer is B. Validation Rule.
Because FLS makes field visiable not mendatory.
Pagelayout is not always the best idea since you might have pagelayout to your profile which doesn't make it necessary.
Samuel StevensSamuel Stevens
So are you saying that the profile may have different permissions that affects the page layout and could potentially override or change things?
Simha YadavSimha Yadav
if you make field mandatory in page layouts,when u insert bulk data through dataloader that time it will not work,means allow to insert  the data.
I think we can deactivate the validation rule on data import then it won't fire but if they are active then data import will have an error.
And as far as the page layout goes, Let's say One object O has 2 pagelayouts x and y. Profile A has layout X and Profile B has layout Y. If field Notes__C is required on X pagelayout and not on Y layout then profile B can save record without touching Notes__C.
If the field is uniersally required then it is mandatory no matter what pagelayout says.
I needed to be 100% on this so for anyone wondering, I did a double check of this and I think the quiz is correct.  

Question 1  - Answer A. User has Read Only access. Here's why...
  1. I set it as Required via the Page Layout, not during field creation.
  2. Create a text field on Contacts, do not check Required in the field create wizard.
  3. Choose Read Only during field creation.
  4. Add field to Layout and a few Profiles (one should be non-Admin Profile to test with, because Admins see Read Only as Editable.)
  5. On your chosen Page Layout (mine was Contacts)
  6. Edit Page Layout. Find field. Hover over it and click Spanner.
  7. Within Page Layout check the box for "Required".
  8. Save Layout. 
  9. Log in as another non-Admin user, who has Read and Edit access to object.
  10. Can see, but not Edit the newly required field.
  11. Can save record without issue.
  12. So "Required" on Page Layout does NOT  override "Read Only" at field creation.

Note if you make field Required when creating a field there's no confusion.

Question 2 - Answer D  - Field Level Security is correct. 

FLS is the most correct answer here. Easiest way to implement something required for everyone.  The exams may have several answers that are right, we need to choose the best solution if only one answer is allowed.
  • Via Page Layout can be overridden by FLS ( Question 1 test above proves that).   
  • Validation rules can get into trouble if a field is validated against that is not on Page Layout. (I've had this happen). And there are intended to make fields "conditionally" required, not always required. They are for improving data quality. 
  • Roles & Profiles is a a test because you can access FLS via Profiles for already existing fields. But Profiles is not how to set a new field's requirement and you would need to apply this to all profiles manually if you approached this way.
Using FLS to make a field Required
  1. Create new custom field. Do the usual, choose type, add name, etc.
  2. Check box to make field Required. ( i.e. FLS )   
  3. Next, field is automatically visible for all Profiles (you have no choice) and Read Only is disabled within the Field Create steps.
  4. Next, field is auto-added to all layouts for object.
  5. When you open settings...
    1. Edit Page Layout
    2. Click spanner for the field Required is already checked, (applied to all Page Layouts for the object).
    3. You cannot uncheck "Required" or check "Read Only" via Page Layout. (Read Only is in affect disabled).
    4. You can't remove the "Required" field from the page layouts. You will receive an error.
    5. You can later go into the field after creating it and uncheck "Required" if needed. Then you can amend as normal, setting read only or required via the Page Layout.