 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 screen flow. So let's understand the requirement of this scenario first. So we need to create some flow element so that we can create contacts or cases or opportunities related to account record. So this scenario will help you to understand how to use subflow element in screen flow. So basically, there will be total four flows. One that will be creating contacts separately. One that will be creating cases separately. One that will be creating opportunities separately. I will be using those three flows as a subflow in the main flow that will be really executing in the front and in the back end, it will be calling the other flows as a subflow. So let's jump to developer edition all. So first of all, I'm going to open three flows that will be considered as subflows. So here you can see create opportunity on account. So it is being opened then create case on account and one will be for contact. So let me search for that. So create related contact on account. So these are three screen flows that are that I already created in the previous demonstrations. So here you can see this flow will be like receiving contact information through the screen, then through this create record element contact will be created and it is having upload file as well. Right. Then we have case. So here case information will be retrieved and case record will be created through this create case or create record element. And this is the third one, which is for opportunity. So opportunity information will be retrieved through these screens and through this create record element opportunity will be created. Now I'm going to create one more flow. So this new flow will be a screen flow. Right. In this flow, I will be having a screen where I will ask a user like which type of record you want to create. So, naming it as object selection and having a pick list, naming it as select an object. So here I need to create three choices. So I'm choosing choice because here I need to create choices manually. So here you need to like provide API name as contact label as contact and value as contact then done. So now I'm adding one more choice is choice will be for case, adding one more choice. This choice will be for opportunity. So these three choices are available now in this pick list clicking on done. Now I need to add a decision. So labeling it as check object selection is contact. So we need to choose this select an object pick list that is available on screen component if it is equals to contact. So this is our first outcome. Then one more outcome for his case. So select an object equals this time we need to choose case. Then click on this plus and have one more outcome for opportunity. So select an object equals opportunity. Right. So this way three outcomes I have created clicking on done. So now from here I'm just ending every path right now here I need to have this action that is element that is subflow. So if I choose it so from here I can search. So initially we have contact. So for contact we need to choose the flow as this create related contact on account. So here it is labeling it as create contact. Now it requires this record ID as input. So we need to include it right now in this flow in the main flow where I'm calling all the subflows we don't have any record ID variables. So I'm just creating a new resource as a variable naming it as record ID data type text available for input and done. So this record ID will be passed into the subflow. Now here we need to add case flow. So again subflow element. So we need to search for case flow. So I'm copying it pasting it. So here labeling it as create case, then we need to pass record ID. So this time we don't need to create new variable because I already created it. So we need to pass it as an argument. And one more thing is available like if you want to open this flow, like if it is not opened already so you can just click and it will be opened a new window. So I'm clicking on done. Now I need to have this one for opportunity. So I can have this subflow. And here I can write create opportunity. Then I can pass the record ID and done. So this way, all the subflows are connected now, and I can click on save. So this is the label of the flow and I'm clicking on save, activating it. Now if I move to account and open any account record. So you just need to click on this gear icon, click on edit page. So here I have this flow. So I'm just clicking on this flow element and I'm going to change it. So I'm going to select this one right subflow and enabling this checkbox and clicking on save. So here you can see object selection is there. So I'm selecting contact. So we have only one contact here clicking on next. Adding contact as con 101 contact 201 is the last name clicking on next. It is asking for upload files so I can attach any file and finish. So here you can see contact is created and it is linked to account automatically. And now we can select any other option and we can go and fill the information. So this way you can test it for other objects as well. So I hope you understood like how you can use other flows as subflows in the main flow. So here we have total four flows. This flow I'm calling it main flow and these flows are now treated as subflows. Now, like these flows can be used independently as well as they are part of this main flow as well. So to reuse the flows we use subflow element. So this is all about how you can use a flow as a subflow in Salesforce.