 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. Let's understand the requirement first so that you can know how we can implement a scenario based on record trigger flow. So the requirement is we need to manually share a record. So if you want to share a record manually upon its creation so you can use record trigger flow. So first we will be setting the OWD for account object as private so that we can make sure like the users are able to access the records which they own or the records which are shared with them. Then I will be creating a record trigger flow which will automatically share the account reports upon their creation with a particular user. And then we will see like whether that report is shared with the user or not. So jumping to the org. So I'm just searching for sharing settings so that we can apply OWD for account object as private. So I'm just clicking on edit and here I'm just selecting private then just click on OK. So it is private now I'm just clicking on save OK. So it will take some time maybe in seconds or minutes. So what you can do you can just refresh this page and see whether it is applied or not. So right now it is public read write so we need to wait for few seconds more. So here you can see it is showing the warning like one or more sharing operations has been initiated. See below for additional details. Certain operations may not be available. So if you scroll down so you can see I applied OWD for account objects or account opportunity and case sharing rules are also like they are being refreshed if they are available. So that's why this warning message is available here. Now I'm going to refresh this page again. So now you can see for account object OWD is set as private right now if I take you here. So right now I'm logged in as Sanjay Gupta. So this user let's see the user's profile. So for this user you can see profile is system admin. So system admin can basically access all the reports. So if I go to accounts so we are on all accounts. So here you can see we have total 36 account reports and all account reports are owned by Sanjay. One is automatic process rest are owned by Sanjay right now if I try to log in with another user. So here you can see we have one more user whose profile is standard user and login button is available here so we can directly log in with this user. Now you might be thinking like from where we can have this login button so for that you can search for login access policies and from here you can enable this checkbox. Administrators can log in as any user. So if you enable this checkbox in that case if you are logged in as system admin so as a system admin you will be able to log in with another users. So I'm just clicking on login. So here you can see I am logged in as Arush Agriwal. So if I go here to accounts. So I already applied OWDS private so you can see I am on all accounts still I can't see any record because from this user I have not created any user as of now right so what I'm going to do now if I create any new record as a system admin user so that record should be shared with this user automatically so that I want to do with the help of record trigger flow. So I'm just logging out with this user and I'm going to log in with my system admin user again and I'm going to create a record trigger flow now. If you have applied OWDS so it means user can view the reports which are owned by that user. If you want to share the reports of another user so that you can do with the help of report trigger flow. So I'm going to create that now. So I selected report trigger flow clicking on create. So from here I'm just searching for account then a record is created. Now here I'm providing condition like on account we have a pick list that is active equals to yes if that pick list value is equals to yes that only this flow will go forward. Now after this we need to share this record with the user. So what you can do you can just select create reports element and here you need to select this use separate resources and literals and here you will find one object known as account share. So right now we need to share account record that's why account share is available. If you create it for context so you can find context share as well. But for that you need to apply OWD as private for context. So right now it is not available. If you apply OWD as private then only you will be able to see that. Because if OWD is public or public read only or public read right so those reports are already shared. So from here I'm selecting account share. Now, if you want to share particular reports so you need to populate these fields. Right so you need to provide user or group ID with whom you want to share then row cause then opportunity access level then case access level then account ID, then account access level so these you need to fill. So we have like account ID we can set account case and opportunity access level we can set row cause as well but we need to have the user ID like with which user we want to share the record. So before creating this element create records element for account share we need to get the account we need to get the user information. So I'm going to use this get records element. So we need to get users details so I am searching for the user. So here you can see user fields are available. So from here I'm just copying this username. So if username equals this value. So that user record will be fetched and we want to fetch only the first record automatically store all the fields and done. So this way, the user record with whom I want to share the record that information is available in the flow. Now I can create that create reports element. So, so we need to create account share reports so here we will be searching for account share. Now, first of all, I'm setting this user or group ID. So we have get users detail, then we can have dot user ID. So here is the user ID. Then we need to select account ID. So account ID you can have from this dollar record. This is a global variable which have the information of the record through which this flow will be triggered. So whenever you create any account record so that account records information will be available in this dollar record variable. So through that we can pass the ID and we can assign into account ID. So this is important because if you are creating account share record so that account share record should know like for which account record this account share record is being created. Then we have no pause. So here we have these values. So this is a pick list value which have like these values so you can you can select any value from here. Like, it is a reason like you are sharing the record so I'm going to select this is a manual sharing. So I'm selecting manual like so that if if you want to see like with which medium this record is being shared so I'm just selecting a row causes manual then add fields. So now we have access level so for account I'm going to set access level as read write. Right so we have another as well so if I take you again so we have read only read write owner. So from these three you can select any value. So I'm selecting the right. Then account is having related case and opportunity so for case what you want to set so I am setting need on me and for opportunity I'm setting as read write right so this way these fields you need to set these fields are for account share object so once you set all these things and then you can click on done click on save. So I'm naming it as account share clicking on save. Activating this flow. So now I'm going to create a account record and here you can see I'm logged in as Sanjay Gupta which is system admin user. So I'm going to create new record and you will see like when I will be logging with that another user so that user will be able to access this account record. And here we need to set this active as yes because this was the entry criteria if account active is equals to yes then only that flow will run. Now I'm just clicking on save. So account record is created. Right so here is the account record. Right so we are able to access it through system admin user because that user is the owner. And here if you go to sharing. So here you can see this record is shared with the user which we get the flow and for account access read write for a case read only and for opportunities read write. Now if you want to verify through logging in with that user so you can do that as well. So just log in with that user. And go to accounts tab. Here you can see account demo for sharing owner is Sanjay but this user Irish is able to access this report because this record is shared with the help of the flow. So this way, with the help of this flow I hope you understood how you can share a record where would be set as private, which is owned by one user with another user.