 Hello friends. I'm Sanjay Gupta. I welcome you on Sanjay Gupta Tech School. In this video, I'm going to demonstrate you a new feature of flow that is record triggered flow. So I will be demoing you like how you can use before the record is saved feature and after the record is saved. Before starting if you want to watch more Salesforce related videos, you can go to description of this video and you will find various playlist links so you can follow them as well. So now moving to the org so I'm clicking so to create a flow in setup you can search for flow and then you can click on new flow. So first I'm going to demo you before save. So for that purpose, I will be taking account and contact model so whenever an account sorry whenever account record is created. So I want to copy a particular field of account on contact. So we need to click on this option. So right now I'm choosing a record is created only and before the record is saved. Right. So read this information carefully because whenever you use this record trigger flow as before the record is saved. So current record information will be available in this record global variable. Right. So you can use that. So I'm clicking on done. Choosing the object as contact because this will be triggered when contact record will be created. So this is set trigger or record is created run flow before the record is saved and object will be contact. So here you can see only that record option is available and assignment decision loop elements are available. Right. So now I'm going to use a decision. So I'm going to check whether account is populated on contact or not. So I'm using this record dot account ID is null false. It means if this condition is true it means account ID is populated. So if it is populated then we need to get the account information. So I'm getting a count. So here we can put the condition as ID equals and record dot account ID. So on contact the current record through which this will be triggered. So that record will be having account ID. So if it is equals to one of the account record then I'm clicking on done. So I'm connecting this. Now I'm using one assignment. So assign value now in the current record that is contact we have phone option available. So let's say I'm using mobile phone equals and we received information in this data account dot phone. So account phone will be stored in this mobile phone automatically. So I'm clicking on done. So I'm just using these field for demo purpose you can use any other field as per the requirement. So I'm saving this. So before save on contact clicking on save activating this. Now moving to contact record creation. So before that let me choose a particular account. So this is Burlington textile Corp. And here I'm seeing your phone number is populated. So now I'm going to create new contact. So here is the flow trigger. This is the name account. I'm going to populate. So this is the account and now I'm clicking on save. So go to details mobile. You can see this option is this field is populated automatically. So three three six triple two seven triple zero. So if I open this account. So we need to match both the phone numbers, whether they are same or not. So here in the details you can see. Yeah, this is the phone that is populated here. Right. So it is working properly. So this way I demonstrated you like how we can populate field of a particular record to another record so which is associated. So now if I try to create one more contact. Without linking it to any account. So let's see what happens then so test. No trigger one. And this time I'm not populating account and clicking on same. So as in flow we use the condition. So if it is populated then only that assignment will happen. So here you can see right now mobile field is blank. So this way you can use before the record is saved option of record trigger flow. So you can use this option as well like record is updated or both created or updated. So this way I demonstrated you this one so this is first part that I explained before the record is saved now moving to after the record is saved. So for that I'm going to create one more flow. So in this process what I'm going to do. I'm going to create an account and after creation of account. I just want to create one opportunity record that will be associated with that account. So for that requirement. Again I'm choosing a record is created this time I'm choosing after the record is saved option. So now you can see the difference. So this is after the record is saved option. So here you can see create record update record get record delete record and these actions. All these options are available. But in case of before the record is saved only get record option is available. So this is the basic difference in these two. So this will work on account. Right. So, whenever account record is created, then we need to create the related opportunity. So if you see this option so here also you can see the option the flow can access most flow element the record global variable contains the Salesforce record that that launches the flow. Those information will be available in the global record variable. So now I need to create a record. So this we can do in after the record is saved option so create opportunity. So you separate resources and object will be a opportunity. Now here we need to set the field so we need to set the name. So I'm setting name as account name. So whatever name of account. A postulate name will be same. Then we need to set the stage. So stays I'm setting as prospecting. Then close date. So let's say for close date. We can't use this. So I need to create new resource here. So I'm creating a formula. And then count ID. So that will be available through this record ID. So current record ID that will be account on which this flow will be triggered so that account ID will be stored in this account ID that will be available on opportunity. So now whenever you will be creating account, automatically one opportunity record will be created associated to that account record. Right now I'm saving this. So after save and I'm activating this. So this time I need to create new account. So name is test after save. And I'm clicking on save. So account record is created and in related you can see one opportunity is created. So first see the details of account. So this is the name of account. And if we move to opportunity details so you can see opportunity name is same as account name. It's closed it is today's date and if we open this opportunity. So we can see other details as well. So here you can see it is sorry this is this is actually account which I opened. Let me again go to opportunity. I need to click on this option now opportunity details are available. So here you can see opportunity name and account name both are same account is populated here as a master detail relationship. Closed it is available stages available right so everything is available properly. So as I created account automatically an opportunity record is created. So this way after the record is saved as having more options. So it is richer in feature so you can use create update get delete all the options whereas in before you can use only get record option. Right so these two options are available with lightning flow. So in place of trigger I guess you can use these tools as configuration part. So you don't need to use any process builder to call these flow. So these are record trigger flow. Once you create or update your record these will be fired automatically. So I hope you understood how we can use these two things in record trigger flow that is before the record is saving after the record is saved. So I hope you understood both the demonstration so you can implement these in your demo or whenever you will be working on any project so if these are required so you can use them as well. So instead of using auto launch flow that that is called through a process builder or any other tool, you can use record trigger flow that is automatically called whenever record is created or updated. Right, so I hope you enjoyed this video and learn new thing with this video. And if you want to watch more salesforce related videos you can go to description of this video. You will find links of various playlist there so you can watch them too. Thank you for watching this video.