 Hello friends. I am Sanjay Gupta. I welcome you on Sanjay Gupta Tech School. So in this video, I'm going to demonstrate, delete a record data element that is available in Lightningflow. And for example, we are going to delete the opportunity record when its stage is set to close loss. So before starting, let me promote myself. So my YouTube channel you can search by my name Sanjay Gupta. So if you want to follow Salesforce training videos, you can search it. Here various playlist related to Salesforce and other programming languages are available. So now I'm going to create flow and then I will be creating a process builder that will call that flow. So clicking on new flow button and type of flow will be auto launch flow. Here, I need to create a variable first, that will be for opportunity ID. So its name, all you can say if your name is opportunity ID, its data type is text, and it will be available for input. So process builder will provide this opportunity ID to the flow. And from here I'm just picking up delete element. So label is delete opportunity, then how to find records to delete. So use the IDs stored in a record variable or record collection variable or specify condition. So ID is not stored in record or collection variables. So I'm just picking up this condition object is opportunity. So if you have a record variable, then you can choose first option. This is otherwise you can specify the condition. So here I'm choosing ID equals opportunity ID. So if opportunity record ID matches with this opportunity ID, then we need to delete the opportunity record. So I clicked on done link this. So this way our auto launch flow is prepared. So its label is delete opportunity, clicking on save, clicking on activate. So this is available for use. Now moving to process builder. So here I created one process for opportunity automation. It is for opportunity creation and application. Now here I need to put the criteria. So check stage. So here we need to choose the stage of opportunity as closed lost and one more condition for stays. If it is changed. So if opportunity stays is changed and its value is equals to closed lost, then only this process will execute and action is all the flow. So here delete opportunity flow is available because it is auto launch flow. Now we need to pass the variable for flow. So opportunity ID we need to pass from here you can choose field reference. So here we need to pass opportunity ID. So I'm searching for that. So here it is opportunity ID. I'm clicking on choose clicking on save. So this way process builder and flow both are linked. Now I am activating this clicking on confirm. Now moving to opportunity tab. So here you can see various opportunity records are available and stays are here. So let's say I am choosing this opportunity test opportunity from flow moving to its details. And I am copying this record ID so that we can test it whether it is deleted or not. So from here I am changing its stays to closed lost. And I'm clicking on save. Again, I'm clicking on this tab. So here you can see that opportunity is not available. So now I'm going to put that ID that I copied. So it will show an error that this record is not available or it is. It cannot be opened. So yeah, here you can see looks like there's a problem. We couldn't find the record you are trying to access. It may have been deleted by another user or there may have been a system error. Ask your administrator for help. So why this message came because we deleted our opportunity with the help of this flow and process builder. So whenever you set opportunity stays as closed lost. Then process builder will fire and that process builder will check the condition whether the stage is closed lost or not. If it is, then the flow will execute and flow patches the opportunity ID from the process builder and it deletes your opportunity. So it won't be available for you. So this way I demonstrated you how we can delete opportunity record when it stays is set to closed lost with the help of delete a record data element and flow. So this way you can also use this data element in your projects and assignments. So I hope you understood whatever I demonstrated in this video. If you want to watch more Salesforce training video, you can search my name Sanjay Gupta on YouTube and you can follow my YouTube channel. Here various playlist and here various playlist related to Salesforce and other programming languages are available. So you can follow them. Thank you for watching this video.