 Hello, friends. I'm Sanjay Gupta. I welcome you on Sanjay Gupta Tech School. In this video, I'm going to demonstrate how you can create a recording flow. So I'm going to demonstrate in two different ways. So first, we are going to create a record using screen flow and second method will be creating a record using auto launch flow. And the example will be we are going to create a contact record that will be related to an account report, right? So if you want to follow Salesforce training videos, you can search my name Sanjay Gupta on YouTube and you can follow my YouTube channel. So my channel contains various playlists related to Salesforce and other programming languages. So you can follow them. So now coming on to the topic. So first I'm going to create a screen flow and then with the help of that screen flow, I will tell you how you can create a contact report on account. So from setup quick find, you can search flow. So if you click on this flow link, so at right hand side, you can see this flow screen will be available. And by clicking on this new flow button, you can create a new flow. So now I'm going to click on this button. So it will open up in a new tab and it will ask two options screen flow and auto launch flow. So I'm selecting screen flow clicking on create. So here you can see flow builder is available and here we can create a screen flow. So if we talk about contact, so whenever we want to create a contact, so one field is required that is last name. And if we want to associate that contact with an account, we need account ID as well, right? So first of all, I'm going to create a new resource that is available. Its name is record ID and it's data type will be text and it will be available for input. So why I created this record ID variable because whenever you use this screen flow on any record page, so let's say we are going to use this flow on account record page. So account record ID will be automatically available in this record ID. So name should be always record ID and you should use this checkbox as true like it is available for input. So I'm clicking on done. So first requirement is completed that we have account ID and record ID variable that we can link with while creating a contact. Now I'm going to create a screen. So on this screen, I'm going to read first name and last name, or you can say simply we can read last name as well. So I'm dragging and dropping a text component. So this is my screen. So first I need to put screen label. So its label is contact details. Then I'm clicking on this text component. So its label will be last name and it should be required and I'm clicking on done. Right. So this screen is created. I am connecting these two. Then from here I need to select this create records data element. So label will be create contact. Then how many records to create. So we are going to create only one record and how to set the record field. So use all values from a record or use separate resources. So we have separate resources. One is record ID and one is last name. Then I need to select object. So object is contact that we are going to create. And here I need to set the fields. So first time selecting last name with this. Then I'm selecting account ID and this account ID will be equivalent to record ID. So this record ID variable as I said earlier, it will be filled automatically whenever we are going to place this screen flow on account record. Now, if you want to fill more fields like first name you want to enter. So you can choose this one as well. So this way you can fill whatever fields you want. So I'm just filling first name and account ID and clicking on done. And this is linked. So this way our screen flow is created. Now we need to put the screen flow on account record page. So I am clicking on save. So it's label flow label is create contact. Then I'm clicking on save. Clicking on activate. So this screen flow is activated now. Now I need to go to setup. Now how I am going to use this screen flow on account record base. So for that purpose I'm going to create a quick action. So in setup I clicked on object manager I selected account and here I'm clicking on button links and action. So from here I'm able to create new action. Now label of this action will be, sorry action type will be create a record and label will be create contact, right. And we can select target object as, sorry, from action type I need to select flow and flow name is create contact. So by mistake I said create a record because we are creating a record but we are creating a record through flow. So we need to select flow and flow name is create contact and label is create contact that is label for action. Its API name will be create contact. So I'm clicking on save. So you can see our quick action is created. Now I need to put this quick action on page layout so that it will be available on each account record. So this is my layout which I'm going to use to for account record. So here you need to click on mobile and lightning action and here you can see your quick action is available that is create contact. So you need to scroll down and here Salesforce mobile and lightning experience actions. So you need to click and drag and drop it and you can put it at the beginning click on save. Now move to account record. So I'm refreshing this account record. So at top right corner you will see this create contact quick action is available. If I go to related so you can see here only two contacts are available, right. Now I'm going to click on this create contact. So you will see a screen which is asking for last name. So let's say I'm entering last name as Sharma clicking on next. So it is finished and you will see a contact is created here and this contact is having account ID automatically. So I'm opening this contact and in this contact you will see it is automatically linked with that account. Right. So this is the first way. So we created a screen flow then we link this screen flow with action and through that action we created a contact that is automatically related to an account. Now I'm going to demonstrate how you can create a contact record associated with an account using auto launch flow. So I'm closing this window closing this one as well. Yeah, I'm closing this flow as well. Now from here I need I'm going to create new flow. So this time I'm going to select auto launch flow. Right. So in case of auto launch flow, we don't require screens and you can see screens screen element is also not available here. Right. So how we are going to put values here. So this auto launch flow will be called by process builder. Right. So let's say I'm creating an account or I'm updating an account. Right. So that will be calling our process builder and process builder will pass account ID to this auto launch flow. So it means here also I'm going to create a new resource. That will be available. And this time API name is also record ID and this time you can use another API name as well. Let's say I'm using account ID. You can use record ID as well and available outside the flow. Yeah. So it will it will be available for input because it will be receiving account ID from the process builder. So we have account ID now we need to create a record. So account will be created and then we need to create a contact record that will be associated with that account. So for that I'm going to create a contact. So label will be create contact. Then we need to use this option use separate resources object will be contact and last name we need to fill. So let's say I'm filling it with test. So this will be the last name. Let's say I'm adding first name as well. So first. Right. So this is first name test first and test using flow. This is last name. And here I need to add account ID. So this way account ID is linked and I'm clicking on done. Right. And I'm linking it. So this is our auto launch flow that is created. It will receive account ID from the process builder. And then it will create a record automatically. I'm saving it and process. So it's label is this clicking on save. So this way it is available. I'm clicking on activate moving here. Now I'm going to search for process builder. So this process builder is available here. I'm clicking on new account process. From here we need to select the process starts when record changes clicking on save. So here I have to add objects. I'm choosing account and only when I record is created. So I want to create account. Sorry, I want to create contact when an account is created. Right. And I'm clicking on save. This is only the demo. So as per the requirement of your project or assignment, you can implement this accordingly for both creation and updation. So this is demo. So that's why I choose account creation only. Then I'm choosing criteria always run. So no criteria just execute action. Whenever an account is created, it will be having a contact associated with it. Right. And immediate action is flow. And action name is called flow. Here you can see auto launch flow is already available. Create contact through PB. So I'm choosing this one. And I'm adding low because I need to pass account ID. So this is the flow variable that we created account ID to fetch the account record ID. And from here I need to select the fleet reference and I'm typing ID so that we can fetch account ID. So this is account ID. It is available here. I'm clicking on save. So this way process builder will pass the account ID to flow. So whenever you are going to create an account record, process builder will run this process builder will pass account ID to the flow. And then your related contact will be created. And I'm clicking on activate. So this time remember that this flow always creates a contact with this label. Right. So if you have duplicate rule applicable on contact record, so this will fail while you will be creating duplicates. So remember that whenever you are passing account ID from flow, sorry, from process builder to flow, you can also do some automation to generate unique pastime last name. So that duplicate contact record should not be created. And maybe you can use screen flow for that purpose so that duplicate context cannot be created. So for demonstration purpose, I'm showing you how we can call auto launch flow to create a record through process builder. So you can modify this requirement as per your assignment and projects. So here our flow is linked with the process builder. It is a both flow and process builder both are activated. Now here I'm going to create an account record and you will see a contact will be associated automatically with that. So I'm clicking on new. Its name is test ACC or flow. I'm clicking on save. So count is created and in related, you can see a contact is automatically created. I'm opening this contact so that you can view it properly. You can see first name and last name as well. So here you can see in the details. Its name is test first and test using flow. So test first was our first name and test using was our last name and it is automatically linked with this account. So this way I demonstrated you how you can create a record associated with another object using screen flow and using auto launch flow. So I hope you understood how we can create a record using flow by following two different ways that is screen flow and auto launch flow. So if you want to watch more Salesforce training videos, you can search my name Sanjay Gupta on YouTube and you can follow various playlists related to Salesforce and other programming. So I hope you understood whatever I demonstrated in this video. Thank you for watching this video.