 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 screen flow. So let's understand the requirement first so that you can understand the demonstration. So upon creation of opportunity, we need to create an event related to account. And we need to assign that even to account owner. So we can do this through two ways. One, we can create an event through action element. Another way of doing this to use create record element. So I will be demonstrating both the ways one by one. So jumping to developer edition on I'm going to create new flow, selecting screen flow. So first of all, I'm going to have a screen so that we can receive the opportunity information. Sorry, instead of name, I'm going to use the text field. So through that, we are going to receive the opportunity name. Then for close date, I'm using date. Labeling it as close date. And for stays, we need to use pick list. And here I need to use new pick list resource pick list choice set stays name object is opportunity. The type pick list from here, we need to select stage name. So the stays pick list, which is available under opportunity object is now linked with this stays pick list that is available in the screen flow. Now, after this, we need to create a variable named as record ID. So I will be placing this screen flow on account record page. So I want account ID. So that's why I'm creating this variable and clicking on done. Now, after this, I need to use create record element. So create opportunity. Selecting opportunity object. Now here I need to set the opportunity field so that I can assign the values which I received through screen into those fields. So first time going to map name with opportunity name. Then I need to map the close date with close date that I received from screen flow. Then I need to map the stage pick list. So here two options are available. So you need to select the screen component pick list. And then if you want to link this account, sorry, there's opportunity with your account. So you need to populate account ID with the record ID. Now you can click on done so this way opportunity record will be created. Now, we need to create an event that will be assigned to account owner. We need account owner ID. So that's for that purpose we are using get records. So we need to get account details. Now here you need to write ID equals record ID. So only the first record and automatically store all the fields. So you need to click on done. Now, here I'm going to use action. So I'm going to show you first way to create the event. So here you can type event so you will find this new event action. So you can create event so label label is create event so if you go here on account. If you open any account record so here you can see we have this new event action. So we need to fill subject start date and date, date and time. Then we need to assign this to particular user and then it should be related to particular report. So I'm going to fill these so assigned to will be account owner. Then we need to fill date and time so I'm creating new resource. Now here I'm going to fill this default value. So I'm populating six to looking on dump. So this is available then here also I'm using the same date time. If you want to change you can create one more variable. Then these are the required fields then we have these optional fields. So here I'm just using this related record ID and I'm going to relate it with this record ID record ID is basically account ID. So this event will be created under account. So I clicked on done. Now I'm going to save it. So create an event on opportunity creation. See, now you can activate it. You need to go to account record. And here I'm going to edit the page. So we already have this flow here so I'm going to replace it. So create an event upon opportunity creation and then I need to enable this checkbox. I'm clicking on save. Moving back. So on this account record you can see one opportunities available and there is no event. Right if you go to activity. Right so if I refresh this page so you won't see any event created on this. So we only have this task but we don't have any event. So I'm going to create this opportunity. So OPP 401 then I'm populating close date that I'm populating stays and next. So at left hand side you can see 401 OPP is created and at right hand side you can see an event is created. So we didn't assign the subject that's why it is having no subject. So if you open this. Here you can see this is the event assigned to the account owner related to account. Now, here you can like assign the subject location and other details as well. Right. And if you want to assign the subject. So what you can do here you can fill the subject. So this was the one way to create an event from screen flow using action element. Now I'm going to show you like how you can create even through create record element. So I'm just going to delete this. And here I'm going to have create record element. So we need to create an event. So how many records to create one and use separate resources and literal values. Here you can select object as event. And then you need to populate the values. So we need to fill assign to ID. So that will be the case on, sorry, account owner. So I'm populating owner ID. Then we need to fill start date time. So for that I created this variable date time. And we have and date time. So here also I'm using the same variable. You can create different variables so that you can have different start date and time and end date and time. Then here we need to populate related record ID. So API name of that related record ID is what ID. So the account record ID is linked with that what ID. And if you want to put the subject so that is also possible. So right and done. Now I'm going to save as clicking on save. So new version is created. Here you can see version two is created. Now I'm going to activate it. So I need to go to account opening account record where there is no opportunity, no case or event. So I'm going to create the opportunity. So OPP 402. Those eight stays and clicking on next. So at left hand side you can see one opportunity is created and here you can see follow up event is created. If I open this so this time you can see it is having the subject also because I populated that and rest other things are also available assigned to start date time and date time. So this way basically, you can just use two different ways to create an event under account. So first way is to use action element and second way to use create record element. So as per the requirement you can choose any of the option.