 Hello everyone. I'm Sanjay Gupta. I welcome you on Sanjay Gupta Tech School. In this video, I'm going to demonstrate a scenario based on record trigger flow. Let's understand the requirement of the scenario. So I'm going to demo like how you can apply a duplicate check with the help of record trigger flow. Along with record trigger flow to accomplish this requirement, we are going to create a validation rule as well. So let's jump into the org. So first of all, I'm going to create a validation rule and I'm going to apply this check on the contact reports. So here you can see in my org. So all these contacts are available and I will be applying a check basis on the email ID, right? If particular record with same email ID is already available, so you won't be able to create new record. If particular email IDs contact record is not exist, then you will be able to. So I am going to create a validation rule first. Before that, I just need to search for a contact object and I need to create a field as well. So I'm creating a new field. So I'm naming it as duplicate found. So initially it is unchecked because I am considering like initially duplicates are not available if they are available. So I will be setting this value as true through the flow. So visible to all the profiles clicking on next it will be available on the like, if you don't want to add this on the flow because on UI, this field is not required. It will run in the background. So you can just uncheck all these checkboxes and click on save. Now I need to create a validation rule. So here I'm going to insert that field. So it is duplicate found. So initially it is false. And if it is true, then only this validation rule will fire. Right. So, so I'm just showing this message on the screen like error message, and it will show alert duplicate report found, and then I'm clicking on save. So this validation rule is created. So we need to go back to contact and it is active. Now I need to create a report trigger flow. So contact object when it is created and I'm selecting fast field updates here I'm checking the condition like email is not null. So email is null false then only it will run and fast field update because we just need to check the contact record only and then done. Now what do you need to do? You need to get the records existing records and what will be the condition. So condition will be like for existing records if email is equals to the email which is available on the newly created record. So newly created record information will be available in this dollar record global variable. So from here you can fax this dollar record email. So if this newly created records email is matching with the existing context emails. So those records we need to fetch. So you can select all records and automatically store all the fields. So if any record exists with the email ID that is available on the newly created record. So it means this get existing context. So this is a like element which will become a collection variable if it finds particular record. So what we can do we can apply a decision here. So it's not null. So what we can do we can have get existing context is null false. So it means this element is having some data that already exist in the org. Right. If it is not null. So what we can do we can update the field and we need to update the field that is duplicate found as true. And if this is blank if it is empty then nothing will happen and that field duplicate found will be false and you will be able to create the record. But if some records are available in this element it means existing records are available so you won't be able to create the new record because we said that checkbox as true if we said that checkbox is true then the validation rule which we created will fire. So I'm naming it as duplicate check. Saving it. Activating it. Now here you can see I'm just copying this email ID refreshing it. So I'm going to create new record. And in the email ID field I'm pasting this and clicking on saves. So you can see it is showing alert duplicate record form because this email ID is already available with one of the record. Now if I change this email ID I'm adding 123 and I click on save. So this record is being created because with this with this email ID there is no other record available. So this is sort based on this field so here you can see it is only one and rest of the email IDs are already available. So this way you can see, like, how we can apply it duplicate check with the help of record trigger flow, and along with the validation