 Hello everyone. I'm Sanjay Gupta. I welcome you on Sanjay Gupta Tech School. In this video, I'm going to demonstrate a scenario related to record trigger flow. Let's understand the requirement of record trigger flow for this scenario. So requirement says upon creation of account record or related opportunity should be created automatically. So this we can do with the help of record trigger flow in Salesforce. After implementation of this flow, I'm going to modify the flow so that I can add the entry criteria that if account active is equals to yes active as a field on account record, then only an opportunity should be created related to the account. So first of all, I'm going to implement the record trigger flow without entry criteria, then I will be modifying that. So you just need to click on new flow to launch the flow. So here you need to select the second option that is record trigger flow and click on create. Then you select record trigger flow. So you need to decide on which object you want to run your flow. So you can select any object, it can be standard object or it can be custom object. Then here you can see we have various triggering options. So in our requirement, we need to run the flow whenever a record is created. So I'm selecting this first option. And here we need to set the entry criteria. So right now I'm not setting it later on I will be setting the criteria, then optimize the flow for so we have two options fast field updates and actions and related record. So if you want to do some changes or something on the record through which this record trigger flow is initiated, then you can select this option. If you want to perform any action or you want to do certain things on the related record, then you can choose second option. So in our requirement on account record, I need to create a related opportunity. So it means I will go with second option. And I'm clicking on done. So this way you can see these minimum required things are set here. This add schedule paths and open flow trigger explorer for account these options I will be covering in the later videos. So now here you can see it is showing run immediately. So once your account record is created so this path will run immediately and automatically. Right. And similar to screen flow like here we have two options auto layout and free form. So if you want to switch between them so by default, you can see auto layout is available here. So if you want to switch to free form so you can. So this way it will look like in free form. Also, these options are same, but the elements you have to drag and drop from left hand side. So if you want to arrange the layout of your flow, you can choose free form. Otherwise you can go with auto layout. So now I'm going to select element that is create record because we need to create an opportunity related to the account and account we will be creating from the UI. So I'm labeling it as create opportunity. So right now we need to create one and then use separate resources and literal values to set the opportunity fields here object I need to select opportunity. And if I go here set fields values for opportunity so first of all I need to set the name. Now, one thing you need to remember. So if you have gone through the screen flow scenario swings in screen flow. We place our screen flow on the record page or we launch it through the quick action. So in screen flow, if you want to receive the record ID of the record from where the flow is running so we used to create record ID variable in the screen flow. But in case of record trigger flow, you don't need to create record ID variable to store the ID of the record through which the flow is initiated. It is available in this global variable that is known as dollar record. So if you use this dollar record. So this dollar record will contain all the fields information of the record through which this record trigger flow will be triggered. So I'm selecting it and I'm selecting the name. So account name will be assigned to this opportunity name field. Then I'm adding one more field so that I can set the close date. So for close date I'm going to build a formula. So here I'm going to build a formula. So let's say I'm calling it close date. So data type is date and here I'm writing a formula that is today. Okay, so this formula is added here. Now I need to add one more field that is for stage. So stage values will be available here automatically. If I compare this record trigger flow with screen flow. So in screen flow if you want to create any opportunity. So you have an option like for different different opportunities you can select different stages. But here, since this record trigger flow will be running in the background. So user won't be able to select the particular stage name. So whenever any account record is created. So each opportunity will be having the stage name as prospective or whatever you want to select. And then if you want to link newly created opportunity with the account. So you need to set the account ID in the account ID look up. So at left hand side, I chose account ID look up that is available on the opportunity. So opportunity object is having a look up field whose API is account ID. And here I'm going to set the ID of the account record with which it will be connected. Okay, now I'm clicking on done so this way, this create record element is set here. Now I can save this record trigger flow. And I'm clicking on save. And I can activate it. So it is activated now we don't need to place it anywhere. We just need to go to the application and we need to create an account record. So I am on accounts tab. And if I click on accounts tab so here new button is available. So here I need to fill the account information. So ACC 3301 this I'm going to create and I'm not filling any other field and clicking on save. So here you can see we are on account record and in the related list you can see one opportunity is created automatically. If I click on this opportunity record and go to details. So here you can see the values opportunity name is similar to account name account is populated as a look up field value. Then close date is also available today's date then stages prospecting. So this way, automatically an opportunity is being created when I created the account record. So let me go to the requirement again. So first part of the requirement is complete like upon creation of account record or related opportunity should be created. So this is done. Now, requirement says later at anti criteria that if account active is equals to yes, then only an opportunity should be created related to account. So if I jump to my flow, open this configuration. So here I can set the condition. So I just need to select the active. So active is a pick list field and it is having two values yes or no. So I am selecting yes. So if active is equals to yes, then only your flow will run. So I just clicked on done. So here you can see now it is showing conditions one. So one condition is also added. Then you need to click on save as save. So new version will be created. So here you can see version number two is available. Okay, and after creating new version, you need to activate your record river flow as well. Now it is activated. So I will be creating two records to account records now in one I will be setting active as yes and in another I will be leaving it as as default value. So if I click on new, and I create one more account record and here you can see active is none. So I'm clicking on save. So account record is created but opportunity is not created. Now I'm going to create one more account. And this time I'm setting active as yes and clicking on save. So you will see a related opportunity is created now. So this way you can set entry criteria in the record trigger flow. And if you have more than one entry criteria. So for that, you can use and or or you can build your custom condition logic as well. So this is all about this scenario, which is based on record trigger flow.