 Hello everyone. I'm Sanjay Gupta. I welcome you on Sanjay Gupta Tech School. Let's understand the requirement that I'm going to demonstrate in this video. So I will be demoing like how you can call Aura component through screen flow. So first we will be creating a lightning Aura component. Then we'll be creating a screen flow and we'll be calling that Aura component inside the flow. And then I will be placing the screen flow on record page. So the requirement is like whenever we are going to create any record through screen flow. So we need to redirect or we need to open that newly created record automatically. So this functionality I'm going to demo you with the help of this scenario. So jumping to the org. So I'm going to create a component first. So I'm in developer console and from file new I'm selecting lightning component. So I'm going to name it override finish behavior. Right. So whenever our screen flow finish button will be clicked. So this Aura component will be executed automatically. So I clicked on submit. Now here I need to implement one interface named as lightning available for flow actions. Right. Now here I'm going to create one attribute naming it as record ID and type is string. Right. So this way the view of this component is created. Now here you can see I have created a record ID variable. So this record ID variable will be having the ID of the record. And now I'm going to create one more file that is design file. In this design file, I'm going to create a design attribute naming it as record ID, labeling it as record ID. So now let's understand the requirement of this design file. So what will happen whenever you will be using this Aura component in the screen flow. So this record ID will be available there to receive some input from the flow. So that input will be available in this record ID variable that we are creating in the design file. So that this variables value we can use in this Aura component for processing. So if you want to receive some input in the Aura component, so in that case you need to use this design file. Right. Now I'm going to create the controller. So inside controller, I'm going to define a function name as invoke. So here, first of all, I'm going to write the command get the record ID attribute. And here I'm going to create a variable record equals to component or get V dot record ID. So this is the variable that we declared here. Right. Now get the lightning event that opens a record in a new tab. So you need to create a variable variable name can be anything. So I'm taking it as redirect. Then dollar a dot get an E dot force Poland navigate to S object. Right. Now we need to pass the record ID to the event. So you can write the direct dot set parents record ID and then record. Okay. So here, like I explained you get the record ID attribute. So basically this record ID attribute that we are going to fetch. So this is basically the, this one, which is available in this design file. Right. So after this, what we can do, we can write the direct dot fire. So it will basically opens the record. Right. So this way now I can save it. Now I'm jumping to the screen flow. So this screen flow I created in the last demonstration. So here you can see we are receiving name, close date and stage. Then we are creating this opportunity record. Now after this, I can have an action selecting type correction. Okay. I just need to do a refresh so that newly created lightning component is available in this flow. So now if I select action type or action override finished behavior. So it is available. So here you can see this record ID input variable is available. This is because of that design file. So I'm enabling it. Now here we need to pass the newly created ID. So I'm just canceling it and coming back here. So you can see whenever this opportunity will be created. So you need to enable this checkbox. And here you need to create a variable where we can store the opportunity ID. Now click on done. Select the action type will be or action then override finished behavior. And here you need to select that opportunity ID. So newly created opportunity ID will be passed into this record ID variable. And this record ID variable will be passed to that event that we created here. So it will be set here. So through this, we are getting that record ID. And here we are passing that record ID into this redirect variable, which is linked to this event. Now if you go to advance, so here you can assign values manually. If you want to receive some output from the lightning auto component so that you can assign into variables with this. So I'm just clicking on done. Save as. So now I need to activate it. So this flow is already placed on the report page. So I'm going to run that only. No, that is not available. Actually, this auto component is placed. So I'm just going to edit this space. So click on this gear icon and click on edit page. So in previous demonstration, I just used screen flow in the auto component. So I placed for a component here. Now I'm just removing this or a component. And I need to place the screen flow. So I need to select flow component. So I'm selecting it enabling the checkbox so that account ID will be passed. And I'm clicking on save. Moving back. So generally what happens through flow whenever we create any record. So it doesn't redirect to that newly created record automatically. So now I'm creating one more record. Opportunity record. Direct. So opportunities created. And here you can see it is automatically redirected to that newly created record. Right. So this way. With the help of that event, I hope you understood how we can redirect to the newly created record. Now let me just remove this. So I think it is not required. Okay. Okay. So what happens like if you are creating any attribute in the design file, so you need to declare it here as well. And then you can use it in the design file. Right. So this is the variable which is available in the flow here. So we are, we are passing some value. Right. And this design attribute we are receiving here through this component or get. So basically whenever you create any design attribute here, so you need to declare it here as well. Okay. So this is the demonstration like how you can call your lighting or a component in the screen flow so that you can overwrite the finished behavior and you can redirect to the newly created record.