 Hello everyone. I am Sanjay Gupta. I welcome you on Sanjay Gupta Tech School. In this video, I'm going to demonstrate a scenario based on record trigger flow. We are going to use create record, update record and send email action. So create record and update records are element and send email will be an action that I'm going to use in a flow. So I will be demonstrating how you can use these things together. So the requirement is whenever we create any account record and if annual revenue is greater than equals to 10,000, then we need to create one related opportunity to account through create record element, send email to account owner. Also update the description field of the account saying opportunity is created. If on account creation annual revenue is less than 10,000, then we need to just send an email and we need to update the description of account saying opportunity is not created. So in second case, we don't need to create any opportunity. So opportunity will be created if annual revenue is greater than equals to 10,000. So let's jump to developer edition so that we can create a new flow. So I'm selecting record trigger flow, clicking on create. So here I need to select the account object and whenever a record is created. Then from here I need to select this condition. And I'm selecting annual revenue is null falls. So if it is not null, it means it is having some value so that I can apply a decision so that I can check whether it is greater than equals to 10,000. Or less than we need to create related records. So that's why I'm selecting this actions and related records option and clicking on done. So now here I need to apply a decision. So I'm selecting decision element which will be checking annual revenue. So if it is greater than equals to 10,000. So here we need to select annual revenue. If it is greater than or equal to 10,000 so it will be our first outcome then I'm creating one more outcome which is less than 10,000. So API name should be different. So I'm appending underscore one here. So if you are unable to find annual revenue directly so you can just use dollar record because whenever this record trigger flow will be triggered upon creation of any account record. So that account record information will be available in this global variable. So if it is less than 10,000 so this is our second outcome. So that's where these two outcomes I'm creating and clicking on that. Right now here I'm just selecting and so that we have separate parts. So now let's see the requirement so if annual revenue is greater than equals to 10,000 then we need to create one related opportunity. So here I'm going to have create record element or create opportunity one then we need to use separate resources and literals here we need to create the opportunity. So we need to set the name. So right now I am choosing the account name so the newly created opportunities name will be same as the account name through which this flow is triggered. So we need to provide the close date. So I'm creating new resource as formula and here I'm writing today. So today's date will be closed it or maybe we can edit this formula later on. If you want to like have like seven days later closed it so you can write today then bracket plus seven. So accordingly you can modify the formula. You need to populate stage. So stage pick list values are available here you can select any value from these options which are available here. And if you want to relate your newly created opportunity with account. So you need to populate account ID lookup that is available on opportunity with the record ID account ID. So this way first task is done like opportunity will be created. Now second task is like send an email to account owner. So we can click on plus then select an action. Then we can have this send email. So we need to fill these information right so send email. So here we need to create body and subject. So I'm creating new resource as text template. So here I'm selecting view as plain text. So this is sample email body or maybe let's say create some. So here it is. So record owners first name will be available here right so this. This is our email body. Clicking on done then subject. Again we need to create one text template. So here I'm writing account is created. So before writing this just select plain text so that that HTML text won't be available in your subject. So I clicked on done. Now here we need to provide the email addresses. So we have first option like collection second or like comma separated. So here I'm including. Okay, just just click on done and we can we can create a variable first and then we need to assign the email ID into that variable and then we can use that variable here. Okay, so I will be creating an email collection. So from this new resource I'm going to create a variable. Its data type is text allow multiple values. Done. And here, like before email alert I'm just using assignment at emails. So here I'm using emails, the collection variable then clicking on add and then report dot owner. email right so owners email will be added into this collection variable. Now I can use this collection in this sent email action so I'm enabling this and here this emails will be available and I'm clicking on done. So this phase second requirement is also implemented that is to send email to account owner. Our third part is like update the description field of account saying opportunities created. So, so in this case like we need to update the trigger triggering report through which this flow is triggered so you can select this option, it is a shortcut, and you can just select this update recorded option, right. So if I select this. So, same UI will appear right same UI will appear and like if I close this and if I click on plus and select this update record so you can see the same eyes of the same UI is available here. So we need to update account, and this time you need to select this option use the account report that triggered the flow. And here you can pick the description and you can write or should it is created. Right so now the first part of the requirement is complete now we need to implement the second part. So here, if it is less than 10 so we need to send an email, and we need to update the description. So here I'm just copying this right so this action be created we just need to copy this element. I'm pasting it here. I'm copying this as well and pasting it before. So you can see it is available. This is also created email body email subject email collection, everything is available. But if you want to change that email body like if you go and here you can see email body saying like an opportunity is created. Okay, so I'm just modifying this. I'm just writing welcome so that it will be common if otherwise you need to create two different email bodies so that you can use them. So as per the requirement you can create so I'm just demonstrating so that's why I'm using same email body for both. Right. So now I need to just use update report. So I'm just clicking on this update recording record. So here also you can just copy that element so instead of creating. So let's copy this one. I'm pasting it here. So you can see it is available. And here I just need to modify it opportunities not create. So the complete record trigger flow is implemented as per the requirement. Now we just need to test it. I'm activating it. So now we need to test each and every requirement, which is mentioned. So I'm just going to open sales application. So I'm going to create two accounts in first one on annual revenue will be greater than 10,000. So I'm filling 20,000 and description is blank. Right. So three things should happen opportunity should be created. This description should be updated and mail should be there to account owner. So I clicked on save. And related you can see opportunities created an opportunity name is same as a campaign account 2203. Right. If I go to details. So you can see opportunities created this up this message available here. Now account owner. So if I open it in new link. Account owners email is this. So if I go to this email. So I should receive some email. So here you can see account is created. Hi, account owners first name then welcome and thanks. So this way all three options are working. Now I'm going to create one more account. This time I'm entering and well revenue is less than 10,000. So it is 5000 saving it. So basically related opportunities not created. If I go to details. So description is containing opportunities not created. So which is correct. If I go here. So there should be one email. It is here. So this way, all the requirements are covered with this flow. So you do more than one tasks in a recorded flow. So that is also possible. So I demonstrated this you with the help of this requirement.