 Hello friends, I am Sanjay Gupta. I welcome you on Sanjay Gupta Tech School. In this video, I'm going to demonstrate how you can bypass validation rule through process using process builder. Before starting, if you want to follow Salesforce training videos, you can search my name Sanjay Gupta on YouTube and you can follow my YouTube channel. So now coming on to the topic. So first let me explain you what is the problem while implementing validation rule and process builder and then I will tell you how you can bypass validation rule while implementing process using process builder. So, this is opportunity record. On opportunity, we have account name and account phone. So whenever I populate account on pop on opportunity. So I want this account phone should be populated automatically. Right. And if I change this account phone from UI, so it should not allow me to change this. So for that purpose I implemented a validation rule, which is if account is not blank, and I'm changing account phone from UI so it will be fired and it will throw an error message that you cannot edit account phone. So let me test this first. So I'm choosing account name and I'm putting account phone by myself, right, and I'm clicking on save. So it is not allowing me to do this because I'm changing value of account phone manually. So it is not allowed. So we can do this by process builder because account phone is available on account field. So your account record. So on account record you can see this phone field is available. So we want this to be populated on related opportunities automatically. Right. So this cannot be done. So I'm canceling it. So to populate account phone automatically on opportunity, I created a process builder on opportunity. So whenever we update or create any opportunity, it will run. It's criteria is so it will check account if account is not null and account is changed. Right, then it will fire and it will update the opportunity. So on opportunity we have account phone field, which will be having the value of account phone. Right. So on account, there is a field phone. Its value will be populated on the field account phone, which is available on opportunity. So now I am activating this. So when this process builder run. So again, you will see that error will be phone. So right now I am putting account name, like I'm choosing account only. I'm not changing account phone value. It will be changed by process builder. So when I click on save, so it will throw an error. So you can see, we can't save this record because of possibility automation process failed. So the error is field custom validation exception. So while updating this record through process builder, it is going the validation error because validation rule is true. We are changing this account phone. But now whenever we want to change this account phone from UI that validation rule should run. But if we are updating that field from process builder, then we don't want to run that validation rule. Right. So now we need to bypass the validation rule in process using process builder. So now I have created a field bypass validation rule through process. It is a checkbox lead, which is by default falls. So let me open this. So it is by default falls unchecked. Now I'm going to update the validation rule. So in validation rule, I'm going to use this. So right now I'm putting this with not right. So this way I added this field. So it is unchecked and not will make it true. So this validation rule will fire in both the cases from UI and from process builder as well. But we can bypass this now in process builder. So I'm saving this. So validation rule is created. If we try to check it from UI. So you can see it is working fine. Now I'm going to update the process in process builder. So I'm cloning this. I'm going to delete this because we need to create this again. So check account ID should not be null account ID is changed should be true. So this is our criteria now before applying immediate action for update that account phone. We need to update the bypass field that we used in validation rule. So right now it is false. So we need to make it true. So update validation field as true and choosing record type. Now here I'm going to set this field as true saving this. So this is our first action. Now, when this action will perform so this field value will become true. So in this validation rule if this field values true. So not will make it false. So this validation rule will not fire. Then I'm adding another action that is also update record. So now update phone on opportunity. So select the opportunity record that started the process. So here now I'm going to update account phone field that is on opportunity with account phone that is on account record. So from here I'm choosing phone and I'm clicking on save. So this field will be updated. And after that, I am again adding one more action, which will again set validation field that is checkbox field as false. Because after completion of this process builder that should be true because we are going to use that validation on UI. So I'm setting this as false again and I'm saving this. Right. So this way I implemented three actions and these actions will execute one by one. So first this action will be executing. So it will make this field as true. Then while updating this account phone field that field is true. So validation rule will not fire. So this assignment will take place after this assignment. We are going to set that field again false. So, so that whenever we update account phone field on opportunity from UI so that validation rule will fire. So now I'm activating this. Now I'm canceling it, refreshing this page. So now I need to just populate account. Whenever I populate account on opportunity, its account phone will be populated automatically because of process builder. So validation rule will be skipped because we bypass that with a checkbox. So now I'm going to click save. So here you can see account is populated its phone is populated. Now, if I click here and if I add one more visit in account phone. So watch it carefully. I am changing this account phone from UI. Now if I click on save, so validation rule will fire and this change cannot be done. So this way, we bypass this validation rule with the help of process builder using a process. So I hope you understood how we can bypass validation rule while updating records through process builder. So if you want to watch more successful training videos, you can search my name Sanjay Gupta on YouTube and you can follow my YouTube channel. I hope you understood whatever I demonstrated in this video. Thank you for watching this video.