 Hello, everyone. I am 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 we will be calling ScreenFlow through Aura Component. So first of all, we need to create a ScreenFlow, then we need to call ScreenFlow through Aura and then we will be placing the Aura Component either on record page or we can call it through QuickAction as well. So let's jump into the Aura Component and first quickly create a ScreenFlow. So I'm creating a new flow. So in this ScreenFlow, I'm going to create a screen where I will be receiving some input from the user so that we can create new opportunity. So creating a screen and labeling it as opportunity info. Now from left-hand side, you can just select text as a component and here you can provide it label as name, API will be name and it is required. Then to create a new opportunity, we need to have one more field that is date, close date. So here you can search date and then select date. So this component will be placed. You can provide label as close date, API is populated automatically. You can make it required as well. Now if you want to create a opportunity, so along with name, close date, there's one more field required that is stage name. So it is of type pick list. So from here you can search for pick list component. Now here you can label it as stage name, required. Now what we need to do, we need to link this pick list with the opportunity pick list field. So just click here, select new choice resource and select pick list choice set. So we are going to link this flow pick list with opportunity pick list field that is stage name and done. So now the stage name will be having values populated automatically. Now I'm clicking on done. I'm going to create one new resource variable named as record ID type is text and available for input. So it will be available for input from the aura component. So this time this flow will be receiving the input from aura component. So I just clicked on done. Now here I'm going to select one more element that is create records. So here we are going to create an opportunity. So I am selecting use separate resources and literal values object. I'm selecting as opportunity then name. So on left hand side you can see this name is a field of opportunity and right hand side we are receiving name from user in the name screen component. So I'm linking it. Then we need to add one more row so that we can link close date. So this left hand side is field and right hand side is screen component then adding one more field. So this time I'm going to link stage. So here we have two stage names. One is pick list choice set and one is screen component. So you need to select screen component because it is all automatically having that pick list choice set. So I linked it. Then we need to populate the account ID with this record ID so that the opportunity which you are creating. So basically we will be creating this opportunity on the account record. So it should be linked to the account record automatically after the creation. So with this it will be connected and now I'm clicking on done. So this way our screen flow is created. I'm going to save it. I'm saving it as screen flow for aura and it is the API name for this flow and I'm just clicking on save and activating it. So this flow first part is completed. Now I need to create an aura component. So I just need to click here on gear icon. I'm just opening developer console. Now here I need to create new components. So I'm closing this file clicking on file new and from here I'm selecting lightning component. So I'm going to name it as call flow. And I will be placing this lightning component on the record page and prediction. Right. So I'm enabling these two check boxes so that this flow, sorry, this aura component will be available to place on the report page and to call from the prediction. So here you can see two files are available. So this is just for description. So you can close it. And here in this aura component, you need to write your code. So here you can see we have these interfaces which are implemented. So this is first one that is available for record home. Then we have force colon as record ID and then force colon lightning prediction. So available for record home will make it this lightning component will be available for placement on the record page. Then if you want to fetch the ID of the record on which this flow, sorry, this aura component is placed so that ID will be fast automatically through this interface has a record ID. And if you want to place this aura component on the prediction, so you need this interface. Right. Now, what we can do. I'm just creating one handler. The name of this handler is in it. So if you are not aware much with the code, so this will seem difficult to you, but if you know a little bit of code, so it will be very easy for you. So generally, custom developer perform this operation. So if you created a flow so you can walk with your custom developer or if you are already a custom developer, then I think you will be able to understand this. So this is a handler, which will run automatically in it means it will be initialized whenever your component is loaded on the browser. Value equals to this means this component handler like whatever method you want to run when your component is loaded. The method is defined inside this component itself. And the method name is doing it right. So this doing it method we need to define in the aura components controller that will be written in JavaScript. So before that I need to write one more statement. That is lightning colon flow or a colon ID equals to flow data. So this way lightning component view, this is known as view of lightning component like your lightning flow will be placed here automatically with the help of this ID. So now at right hand side, you just need to click on controller so that JavaScript file will be opened and there you can write the code related to your handlers method. So I'm just copying this name and I'm placing it here. Now here we need to create a variable named as flow and we need to write component dot find flow data. So here you can see we created a markup lightning flow whose ID is flow data. So this I'm finding with the help of component dot find. I just passed or ID and the return the value will be available in this flow variable. Now, after this, we need to set input values in a variable. So we are going to set input values in a variable. So I'm creating variable named as input variables. Now inside this, I'm going to provide the name as record ID type will be string and value. I'm going to fetch through component dot get V dot record ID. Right. So here what we can do we can create one attribute named as record ID and its type will be of type string. So because of this interface has record ID when you will be placing this component on the record page. So that records ID will be available in this record ID variable automatically and that variable we are fetching here through component dot get. So this value will be assigned into this input variable name as record ID. Now we are going to pass this into the flow. After creation of this variable, you can call your flow. So you can write flow dot start flow and inside parenthesis, you need to provide the API name of your flow. So from properties, I can fetch the API name and I'm placing it here and here I'm going to pass input variables. So this way lightning component is created. So you can just save both the files, this components view and this components controller. Now after saving it, you can jump to your account record. So open any of the account record and click on this gear icon, edit page. So lightning app builder is open and from here I'm going to remove the previously placed components. And if I scroll down, so at the bottom, you can see I have a custom component named as call flow. And if I take you here, so our component name is also called flow, right? So this way I can drag and drop it. So you can see I just placed my auto component and it is automatically showing that flow here. So now I can just click on save, go back. So this way you can use your screen flow in the auto component. So here name, close date and stays we can populate and then click on next. So it is executed and this opportunity is not linked here. So let me just check whether opportunity is created or not. The opportunity is created, but it is not connected. So just do a refresh. And you can see like account name is populated here in this opportunities list because it is refreshed. And if you go to account now, so here also you can see the newly created opportunity. So after creation of opportunity, you just need to refresh your page so that it will reflect. And if after completion of opportunity creation, if you want to just apply force refresh so that code also you can write in your auto component. So for that, you need to like search like how we can refresh the page just after action is performed. Otherwise, in this scenario, you just need to refresh your page so that you can see your opportunity linked to the account. So this way I hope you understood like how we can call or screen flow through auto component in Salesforce.