 Hello everyone. I am Sanjay Gupta. I welcome you on Sanjay Gupta Tech School. In this video, I'm going to demonstrate a scenario related to scale. Let's understand the requirement of the scenario. So we need to create reminder tasks on open opportunities. So basically, if you want to figure out like what all open opportunities available. So we have a stage field on opportunity. If it is not equals to closed one or closed lost, it means your opportunities open. And if it is open, then we need to create a task record related to that opportunity. Right. So after task creation, like if we create a schedule trigger flow on daily basis. So what will happen, like, if the opportunities which are available today and they are open. So we need to create a related task on those so that those will be created. Now, next day when flow will be executing again. So we need to make sure, like the previous day, opportunities for them, like we already created a task so next day we don't pick or fetch those opportunities. So to maintain that thing. First of all, I'm going to jump to object manager searching for opportunity object. And here I'm going to create a field. This field will be of type checkbox. So it will track whether a task is created on opportunity or not. So its label is task created. So if it is false, it means if opportunity is open and this checkbox is false, it means we need to create a task record. But if this field is checked and opportunities open, then we don't need to create a task record. So I'm not placing it on any page layout because we don't want to show it on the UI. So the field is created. Now it's time to create the flow. So I'm going to create new flow. This flow will be of type schedule triggered flow. So I selected create. Now here I need to set the start date and time and the frequency. So right now I'm just setting the frequency. Okay, these are required. So I'm just picking random values here. So I just need to figure out like what is the current or date and time so that accordingly I can schedule and I can demo it like whether records are created or not. And here we need to select the object. And here we can specify the conditions like so stays name does not equals closed one stays name does not equals close lost. Task created equals false. And I just need to modify the logic so one or two. No, actually it should be and so if stays is not equals to close one stages not equals to close lost. So here task created checkbox is false. If all three conditions are matching, then only our task will be created on the opportunity. So now I just need to have this element that is create records. So we need to create task record. Okay, so here I'm going to search task fields and if I go here to the task. I just want to see like how we can relate so we related to particular record with related to field. So here I'm going to check the API name of related to it is what ID. So in what ID. I just need to assign dollar record dot ID. Okay, then. So if we create new tasks so we need to check what all required fields are there so we need to have assigned to status subject. So I'm populating subject as reminder task, then we have status. So not started. Then we have assigned to ID. So for this like we need to have a user ID so I'm just assigning opportunity owner ID. So the owner of opportunity will be the owner of the task as well. So assigned to is done status is done subject is done related to is done, then we have priority. So I'm just adding this as well. So this way, this create record element is configured. Now after this, I just need to have one more element that is update record. So we need to update opportunities. We need to update the like dollar record variable because all the records which will be varied through this schedule trigger flow, they will be available in this dollar record variable. So on this, we just need to set it as true because if task is created then we need to set it as true so that next day when this flow will be working so unnecessary. The task won't be created on the opportunities where we already created the task. So this way, this flow is configured. Now, let's say I'm creating this task so that I can know the current date and time of the also here you can see it is 5, 7, 10, 8. So here I'm going to set it 5 and 10 and PM clicking on done save and activate. Now if I go here and search for schedule jobs. So here you will find this schedule task is scheduled and it will run on 1010 it was scheduled on 10, 8. So after two minutes it will be executed. So in the meantime, I'm going to opportunities. So all open opportunities. I'm selecting. Sorry, all opportunities not open. And here you can see we have this stage populated. So I will be checking randomly opportunities like where stages prospecting or closed one or closed lost or any other. So on closed one and closed lost, you will see there will be no task but on other opportunities you will see a task report will be created. So here we just need to do a refresh. So still like this one minute remaining. So within one minute this schedule task flow will be executed anytime like in future if you have scheduled your flow for daily or weekly basis. So if you want, if you don't want to run that flow and you want to like delete that scheduled flow record, not flow, the scheduled job record. So here you can see we have a delete option. So if you click on this delete option so this entry will be deleted. So flow will be there in our but it won't run. Okay, so I am again refreshing the page. So this time you can see it executed. Now we need to check. So I'm just refreshing. So first of all, I'm opening this opportunity. And in under activity you can see reminder task is created. Right. If I open this. So here you can see values are populated. And you can see the date and time it is current or date and time. Now if I open any other opportunity. So let's say I'm opening this one which is closed one. So here you can see we don't have any task created, because it is already closed. Now if I open this one which is having ID decision makers as stays. And here also you can see a task record is created. Right. So this way, I think you can identify whether our flow is working fine or not. Now if you want to see the value of that field. So what I'm going to do on in all opportunities in the list view I'm going to select that. So that we can see the value. So you can see wherever stages other than closed one or closed lost. So it is checked. It means like on next day when your flow will be running. So unnecessary new task won't be created because we applied entry criteria in the flow as stays name does not equals to close one stays name does not equals to close lost and tasks created equals false. This checkbox is false then only it will run. So right now for these opportunities, it is true. So next day your these opportunities won't be processed. So this is important in case of schedule triggered flow, like you need to keep a track on the records which are already processed. Now here you can see it is scheduled for next day. Right. So next day same time it will run again if in your org you have new opportunities created. So this way I hope you understood how we can create task record under opportunities open opportunities with the help of schedule triggered flow.