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
QuickDEVQuickDEV 

Read only field setting

What is the difference setting a field read-only through profiles( I mean at the time of field creation ) vs on page layout? Is there any difference or just two different ways?

 

Thanks!

GavinWillGavinWill

Think read-only at profiles as being the security of the object.

 

read only on page layout means that for that page they can only read the value but elsewhere they may possibly edit the value if allowed on their profile - example through API or via another page where the field is listed but does not have read only applied to that other page layout (hope this makes sense! :) )

 

If security isnt a concern you could go with setting it at page layout however setting the field level security is the best way.

QuickDEVQuickDEV
Thank You!!!
Ispita_NavatarIspita_Navatar

The first one where in required and read-only are set at the time of creation is schema wide setting and it even respected when we execute in system mode - where in s"sharing rules and other page layout settings" are not honored. So basically when you are creating objects via Standard UI the required and read-only both at creation and page layout level are respected but when you create object via code (in Apex) then the page-layout setting are not enforced.