 Hello friends, I'm Sanjay Gupta. I welcome you on Sanjay Gupta Tech School. In this video, I'm going to demonstrate how you can make a field read only. So there are three ways field level security, page layout and validation rules. So first I'm going to show you how we can make a field required using FLS. So moving to account object. So on account object on a particular field I'm going to apply FLS. So here you can see I have a user named as Vikas Gupta and this user is having profile as my user profile. So for this we are going to set field as read only. So I'm picking at annual revenue, clicking on set field level security. So here you can see on this my user profile I am already enabled these two check boxes. So if we check both then field will be visible but in form of read only, right? So now we need to log in as this user so that we can check whether this field is read only or not. So if you apply FLS as read only, it means that particular field will become read only for that profile. So I'm opening this account. So on details, here you can see annual revenue is not having any edit pencil button. So if I click on edit here, so here you can see annual revenue I won't be able to modify. So it is read only and if I try to create new account, so here also you can see I won't be able to set value for annual revenue. So this way this was the first way that is to set FLS as read only so that field will become read only for the users of that particular profile. So while creating any field, this option is also available because if you're creating any field, so this FLS you need to set like whether this field will be visible or read only, editable. So what you can decide there as well. So this was the first way. Now second way is page layout. So let me modify this thing. So now I'm going to remove that checkbox. So I'm making it visible as editable and then from page layout, we are going to set that read only. So if we uncheck this checkbox and first checkbox is checked, it means field will be visible and in form of edit mode. So I'm clicking on save, moving to page layout and from page layout, I'm moving to annual revenue. So here it is, clicking on this property sign and clicking on read only. Clicking on save. So right now I'm logged in as system admin profile. So if I try to visit any account record through system admin profile, so let's see whether it is read only or not. So if I click on existing account. So for system admin, you can see it is still editable because on system admin profile, there's a permission like system admin can edit read only fields as well. So again, we need to log in as Vikas Bhukta so that we can verify this thing. So if we set any field read only from page layout, so there we have option like for all the profile users who are accessing that page layout, this field will be read only. So this is another way. So I'm opening this record. So here you can see I'm logged in as Vikas Bhukta and if I click on details, so here you can see still it is read only because I checked that checkbox on page layout level. So this page layout is having read only checkbox. So if we see this page layout assignment, so if you want that individual profiles will be having individual page layout, then you can control like some profile users can access that field as edit and some can access as read but that maybe you can control with FLS properly. So you don't need to create a separate page layout for each profile. So this way we can make a field read only through page layout. Now comes validation rule. So through validation rule, we can still control this system admin also. So let me first remove that read only checkbox. So I'm removing this, saving this page layout. So now I'm going to create a validation rule. Check annual revenue and here I'm applying is changed. So if you are trying to change annual revenue field, then this validation rule will be fired. So you are not allowed to modify annual revenue. So this error will be thrown and we are going to throw this on top of the page. So whenever this condition will met, this validation rule will fire. So now I'm going to try a count record creation from system admin profile itself. So I'm naming it as test and for annual revenue I'm typing 10,000, clicking on save, so the code is created. Now if I try to change this, so here you can see you are not allowed to modify annual revenue, right? So this way you can also make a field read only with the help of validation rule, but try to use first and second option because FLS and page layout are appropriate way, but you can also apply validation rule like that will cover system admin as well. And you can apply record type check, valid sorry profile check. So all other things you can also apply in validation rule. And you can also apply like on creation and modification you want to apply this thing or not. So normally if we make any field read only, so we want like whenever creating or editing any record, so this should be read only, but here you saw in validation rule on creation it won't throw any error, but on updation it throws error, but if we apply FLS and make field read only from page layout then while creating record, we won't be able to enter any value. So these are three different ways to make a field read only. So you can use them. If you want to watch more Salesforce training videos, you can go to description of this video and you can find links of various playlists there. Thank you for watching this video.