 Hello friends. I'm Sanjay Gupta. I welcome you on Sanjay Gupta Tech School. In this video, I'm going to demonstrate a screen flow scenario. Let's understand the scenario which I'm going to demonstrate. So in my previous lesson, I demonstrated you how you can send an email through email action. But in this video, you will see how we can send an email through email alert. So on contact creation, we will be sending an email message but through email alert. So in flows like you can use both the things you can use email action as well as you can use email alert. So first of all, if you want to use email alert, so you need to use or you need to create an email template. Right. So if I open the existing flow that I created to send email. So what I did, I just use the email action. I just use the email action and in that email action, I can pass body subject and addresses everything. But if you want to use, if you want to use email alert, so what you need to do. So here from here, I'm just removing this. I'm removing this. And if I click on plus, so from action, I need to select the type. And here you can see we have email alert option. So if you have created any email alerts, so those will be available here. Right. So I'm going to create. First, I'm going to create email template. So you need to select classic email templates and click on new template, select text, click on next. Then from here you can choose available for use. Then you can write send email, send welcome email. Then here you need to provide the subject so welcome to Salesforce and here you can provide the body. So if you want to have first name of contact. So what you can do, you can select the first name, and then you can copy this merge field and you can paste it here. Then you can write the message welcome to Salesforce system. Let's start it with your Salesforce journey. Thanks. Okay, so subject email body, I just configured in this email template and I'm clicking on save. Now, after creation of this email template, I just need to create email alert. So I clicked on new email alert. So send contact email notification right object I'm selecting as contact. And then I need to select the email template. So I'm selecting this send welcome email. Okay, so this way I use that email template in this email alert. Now I just need to use the email field of contact from here so that email will be sent to this email field, right. And if you want to have any email ID in the CC so you can write additional emails here, and then you can just click on save. So it is created. Now let's jump to flow and do a refresh. So again, I need to delete these elements. And here I'm going to add action type email alert. So here you can see our send contact email notification is available. Okay, so here I'm writing label as send email to contact. And here I need to provide the record ID, like from which record ID it will be fetching the email and first name last name values. Right, so I just need to do one more thing like when I'm creating this contact. So I need to add. I need to enable this checkbox manually assign variable. So what will happen like whenever this contact record will be created. So the newly created contact ID, I need to store in a variable so that I can use that ID in that email alert action. So I am labeling it as contact ID data type is text and done. So don't forget to create this one. So if you create this under this create contact, right, so here I just mapped the record ID, which is the account record ID email first name last name that we are receiving from the screen. So if I open the screen so you can see first name last name email we will be receiving from the user. And now I can have that action again. Now here I need to pass the ID so I'm going to pass contact ID, right, and clicking on done. So this way email alert action is available now. So this way I hope you understood like in my previous lesson I demonstrated how you can use send email action where in the flow itself you can create body, you can create subject everything you don't need to create any email template or any email alert outside the flow. But if you if you have already created email template and email alert outside the flow. So those email alerts and templates you can use through this email alert action. Right, so now I can just save as it is creating a new version. I'm activating it. So now moving to account. So here you can see I don't have any account created but this button is available. So this button is already linked with this flow. So let me show you how it is connected. So if I go to object manager open accounts tab button links and action so I already created a button for previous demonstration. So if I open this so you can see that flow send email to contact is linked. Okay, so that's why this button is available here I already placed this button on the page layout. If I click on this button. So I need to provide the first name last name. So corn 301 corn 301 and email ID I'm populating and clicking on next. Okay, so there is some error so now no need to worry we will be receiving an email. So we need to check why this flow failed. Okay, so we have everything here but it is failed to create record. Why so because duplicate detected. Okay, so in this org like duplicate rule is activated that's why this record is not getting created so let me just check it. Okay, so on contact we have this duplicate rule and I am going to deactivate it. Right, so, actually, this duplicate rule, basically working on the emails like if same emails are there so I think that's why it is working so let me open the matching rule. Okay, so no worry, I just deactivated it so like in real time scenarios like if you are testing so you can have different different email IDs, but right now I already have that contact created with the same email ID, and I'm trying to create one more that's why it is giving So I deactivated that now I'm trying to create the record again and this time it is created successfully right and if I open this record so you can see the details. And if I go here. So you can see this message is also available first name here and the body and in the subject you can see welcome to Salesforce so everything is same. So this flow is basically sending the email through email alert. And remember like we have two things send email action and email alert action. So, if you have not watched the previous video so do what so that you can compare how to use send email action and how to use email alert action.