 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 edit specific fields of a logged opportunity using protection. So the scenario is I have already implemented one validation rule on opportunity that is checking like if your opportunity is closed or maybe it is worn or lost, then you won't be able to edit any of the fields. So if you try to do so, then that validation rule fires, but the requirement is still we want to modify values of some specific fields. So there is a workaround like you can create a quick action and then you can bypass the validation rule so that you can modify specific fields of the opportunity. So let me demonstrate you this thing. So this is the opportunity and you can see the stages closed one. So I'm opening it and I have already implemented one validation rule. So I'm going to show you. So this validation rule is having two conditions in R. So if a stage name is changed and its prior value, prior value of is closed is true, then it will fire. Or if a stage is not changed but is closed is true, and you are trying to modify any other field, then this validation rule will also fire. So going to detail and let's say I'm going to modify this amount and I'm clicking on save so here you can see you cannot add it closed opportunity, right, but in some scenarios like for some profile users you want to give this additional privilege like after locking the opportunity when it is closed one or lost. Those profile users can modify some of the fields. So what we can do, first we need to create a field checkbox field so that we can bypass this validation rule. So I'm going to create this checkbox. So create, sorry, modify opportunities through protection. So initially it will be false profile you can choose as per your requirement and don't put this checkbox field on any of the page layout and click on save. So by default this checkbox is false. Now we need to use this checkbox field in the validation rule. So I'm going to edit this validation rule. So this is a checkbox field. So by default it is false and I'm putting it into not. So now what is happening. Outer is and and this is not of modify opportunity through protection. So initially it is false so not will convert it into true. Then if any of these options is also true, then this validation rule will fire. But when we are going to modify certain fields through protection, then I will change the value of this checkbox field to true. So not will convert it into false. So this validation rule will not fire in that case. I'm saving this. I forgot to close this bracket. So you can see it is saved. Now again, I am doing a refresh and I'm going to change the value of a particular field. And you will see it will throw the error again. And then I will implement a quick action. So if I try to add this. So you can see still validation rule is working fine. So now it's time to implement the quick action. So update a record so update. So if you have any other opportunities, orderly you can type the success masses and then click on save. And one more thing, like if you want to put a particular profile in the validation rule. So you can do that as well. So right now I didn't put any profile but in your case if you want, you can put that profile as well. So if a particular profile user is trying to modify then validation rule will bypass. So accordingly, you need to put that condition. So here you can see these fields are available. So I'm removing these fields and I am adding description. So I am for demonstration purpose, I'm using only two fields like amount and description, clicking on save. So protection is created now here in predefined field values, you need to change the value of that checkbox so that we can bypass the validation rule. So here it is, we need to set it as true so that it will bypass the validation rule. So it is created. So protection is now ready to use so we can place it on a particular page layout where you want to use it. Click on mobile and lightning action. Search for update opportunities and place it here. Yep. So I'm clicking on save. So now one more thing that we need to remember like through protection, we are modifying the value of that checkbox. So it will become true. So after completion of the execution of that protection to specific fields like amount and description will be updated. But you have to notice that that checkbox is now true. So it will always bypass the validation rule. So after completion of the protection work. We need to create workflow rule like whenever opportunities updated, or you can say like some specific fields that we are using on protection, they are updated. We need to set that checkbox as falls, right? So let me first tell you like what will happen. So now I am just updating this amount and description and clicking on save. So you will see the details. This opportunity is updated and you can see it's status closed one and its amount is updated and description is in test, right? So this we did through quick action. But now if I try to modify this value again, so it will be modified because that checkbox is true and it is bypassing the rule. So after updation of the opportunity record, we need to fire a workflow rule so that we can again set that checkbox value as falls. So now I'm going to do that. So I'm going to create workflow rule. So this rule will be working on opportunity. The rule name you can use as per your requirement. So here I'm choosing created and every time it's edited. Here you can choose that field is equals to true. So it will be executed. Now we need to add workflow action like new field update. So now we need to set that field so update checkbox opportunity and here it is. So we need to set it as falls. Yeah, clicking on save. Click on done. Now workflow rule is activated. So again, I'm trying to update the opportunities. So here you can see I'm adding one more test clicking on save. So it is executed. The opportunity is updated successfully and in the description you can see test test is written. So now I'm going to try updating this and clicking on save. So you can see you cannot add it closed opportunities. So this is because we implemented one workflow rule. So workflow rule is setting that checkbox field again to falls. So this way I demonstrated you how you can implement this kind of scenario. So what we did first we implemented a validation rule for validating like when opportunities closed one or closed loss, then you cannot update the opportunity. Then if you want to update some specific fields for that purpose you can create a checkbox field and you can apply that checkbox lead to valid validation will so that we can bypass it. Then create a protection and protection you can use the fields that you want to modify on the layout and set that checkbox field as true so that validation will be will be bypassed. And then you need to create a workflow rule so that we can set that checkbox field as falls again after addition of the opportunity. And if you want to apply any if you want to bypass any profile like a certain profile users can do this thing or certain cannot so you can apply that check as well. So this way I demonstrated you this background. So I hope you understood whatever I demonstrated. If you want to watch more Salesforce training videos you can go to description of this video. There you will find links of various playlist so you can follow them as well. Thank you for watching this video.