 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 override finished behavior of screen flow. So if you use a screen flow, so at the end of the screen you may find finished button. So if you want to do some operation like if you are creating a record through screen flow and then you want to redirect your control to that newly created record. So that you can do by overriding the finished button of the screen flow. So for that, we need these two things, lightning component and screen flow. So first I am going to explain the lightning component that we are going to use and then I will create a screen flow and then I will launch that screen flow so that a record will be created and then automatically control will be redirected to the newly created record. So I'm in the org. So here you can see I have created a lightning component. So its name is override finished behavior. And here you can see I have implemented two interfaces, lightning quick action and available for flow action. Then one attribute that is record ID. Then this is design file. So here I have created this design attribute and this is the controller. So in controller, method name is invoke and here I'm fetching v.record ID so that is available here in the view. Then here you can see comment is written, get the lightning event that opens a record in a new tab. So this is the event e.force colon navigate to S object and it will be stored in redirect variable. Then we are setting record ID as parameter here. So whatever v.record ID value we are fetching we are storing into record variable and that variable we are passing into record ID. So this record ID parameter will be receiving this value and after that redirect dot file this will open the particular record whose ID we are going to pass. So this code you need to develop for overriding the finished behavior. Now after implementing this lightning component you need to create screen flow. So I'm going to create that. So through this screen flow I'm going to create one opportunity. So on this screen I need to place required fields that we need to use while creating a portion of things. So first I'm taking as text. So text is for opportunity name. So label will be name. Then next I'm taking date. So it will be for close date of opportunity because it is also required field and stage. So stage is a pick list. So that I need to fetch pick list stage and here we need to set choice. So I'm creating new resource, pick list choice set. So opportunity stage, object is opportunity, data type is pick list and field is stage name. So it is automatically available here and whatever values available here that will be available in this stage pick list component. Now I'm clicking on done. So this screen is created now create a record. So here create a opportunity use separate resources. So opportunity object that we are going to create and here we need to set the field values. So screen component name will be assigned into name. Then close date equals to the screen component close date and stage equals to screen component stage, right? So this way I add all these things and now I'm clicking on done, connecting this, right? Now I need to click on this action. So it is some errors. So I'm cancelling it, selecting this again. Let me first save this. So overwrite, finish behavior, I'm saving this. I'm refreshing this page so that we can select that action properly. So I'm again clicking on action. Now it's working fine. So here you need to click on core action and search for that lightning component. So lightning component name is overwrite, finish behavior. So I'm selecting that. So before using this, we need to do one more thing. So when this opportunity will be created, so the newly created opportunity ID, we need to set in a variable. So I'm going to create new variable, opportunity ID and type will be text. Done. So this is important because we need to use this newly created opportunity ID while creating this action because we need to pass it to that lightning component. So provided name then in record ID, I need to pass opportunity ID. Clicking on done, right? So now I'm going to save this and activating this. So when this flow will be executed, so this screen will be having finished button. This screen will be having finished button. So when I'm providing these value and when we will be clicking on this finish button. So automatically this opportunity will be created and automatically control will be redirected to the newly created opportunity. So now I'm moving to account and I'm going to open account record and I am going to edit the page so that I can place that screen flow on account record so that we can create opportunity. And also you can create quick action so that you can launch that screen flow. So you can do both the things. So from here I'm dragging and dropping this flow component here and I'm selecting override finish behavior flow, right? Clicking on save. So now you will see that screen flow will be available on each account record so that you can create new opportunity. So right now I have not linked opportunity with account. So you can do that as well. So for that, you need to pass the record ID, account record ID to screen flow and then you can link that opportunity. It is not available here. Let me edit this page again. So again, I'm placing it. So I have also activated this page as org default. So if you want to make this page default for particular app then that option was also there. So here you can see this component is available here. So actually that activation didn't work. So I deactivated that lightning page again. So now it is available here. So what I need to do, I need to place opportunity name here. So this name I'm providing, picking a particular date, stage clicking on next. So here you can see it is automatically redirecting control to the opportunity that is created recently and name is available here. Close date is available and stage is also available here. So this way we automatically redirected to the newly created opportunity. So this flow is working fine. So the screen worked, then record is created and through this correction, I navigated control to newly created opportunity. And don't remember, sorry, don't forget to create this lightning component. So all these three things you need to create so that your control will be redirected from screen flow to particular record. So I hope you understood whatever I demonstrated in this video. So this way you can override finished behavior of screen flow. So I hope you understood whatever I demonstrated in this video. If you want to watch more Salesforce training videos, you can go to description of this video and you can find links of various playlist there. Thank you for watching this video.