 Hello friends. I'm Sanjay Gupta. I welcome you on Sanjay Gupta Tech School. In this video, I'm going to demonstrate how you can add members to case team using flow. So sometime there is a requirement like you need to add users to case team through automation. So here is a scenario like what we are going to do. When a case is escalated, we need to add the manager of case owner to case team. Sorry, I just mentioned case team role here. So it should be case team. Right. Now how we can do that. So we need to create case team role first. Then we need to check manager is populated on user record or not. So we are going to check this condition also in the flow. If manager is not populated, then that flow won't be working. And at last we are going to create a process builder that will be calling the flow. Right. So these are the requirements that we need to implement to fulfill the scenario. So let's start with the demonstration. So first I'm going to set up and here I am searching for case team roles. So first of all, I need to create case team roles. Because whenever you are going to add a user in case team, so you need to assign a particular role to them. So I am creating it as member role name as manager, then member role setting case access. So we can give three type of access to that user related to a particular case. Private read only or read write. Right. So as the case member will be manager. So I'm going to give read write permission and this checkbox is available visible in customer portal. So if you are using this thing in a portal, so you can enable this checkbox as well. So right now we are not going to discuss that thing. So I'm leaving it as it is. So clicking on save. So here you can see this member role case team role is created. Right. So our first requirement is fulfilled. Now I'm moving to case tab and opening a case. And I'm checking on related list whether case team related list is available or not. So it is not available here. So I need to add case team related list on case so that after adding a member, we can verify whether member is added or not. Sorry, base layout case layout. I'm moving to related list and choosing case team and putting in sorry putting it on first position. Clicking on save. Yes. So this way case team related list is added to base layout. Checking for page layout assignment because in my org I have two record types for case. Yeah. So for both record types I am having case layout. So it is okay now. So second. Sorry. Now we need to check the second thing. So I'm moving to user. Right now I'm logged in as Sanjay Gupta and here you can see manager is populated as Vikas Gupta. But maybe in some of the cases user is not having manager populated. So in the flow we need to check this if user is having manager populated then only flow will be adding user as a case team. Otherwise not. So now the time is to create a flow. So I'm moving to home searching for flow. So I'm going to create auto launch flow and we are going to call that auto launch flow through process builder. So process builder will be passing a variable that will be case ID. So you need to check this checkbox available for input so that this variable can receive input from the process builder. Right. So we created this. Now we need to query. So I am choosing get record element. So here I'm fetching that owner details object. I'm choosing as user and here I'm putting ID. So user ID equals. Okay. So here I need to create one more resource owner ID. So we need to receive this owner ID as well from the process builder so that we can use that owner ID here for the condition testing and leave these as it is. So we received owner details. Now we can apply a decision. Why this so that we can check manager check manager on case owner, whether manager is present or not. So it's present and so owner detail dot manager ID is null falls. So if this condition is true, it means manager ID is populated on the owners user record. So if it is true, then we can go further otherwise not so further we need to get one more thing. So here we need to get case team role that we created earlier. And here I'm going to search for case team to check for name equals. Now we need to use that name so case team case team roles. So I'm opening this. So here we provided role name as manager. So copy this and putting it here. Right, so it will be varied. So we need to get case team role. So now I can attach this element. So if a manager is present on user record so then we can get case team role. Right. Now we need to create new record. For case team member, right. So create case team member. So here we are going to choose separate resources. So case team member. Right. And here we need to pass these three things manager ID, then add fields parent ID. Sorry. And third one is team role ID. Right. So member ID will be the manager ID so that we have in that owner details thought manager ID, then parent ID will be the case ID. On which record you are going to attach that manager as a case team member and team role ID that we receive through that team role. So these three fields you need to map so that case team member will be created on a particular case. So I'm clicking on done. I'm clicking these. So this way first we received owner details and we check the manager, whether it is available on user record or not user means owner of the case. If it is available then we query the case team role ID, then we put all three things owner ID, sorry, owners manager ID case ID and case team role ID, so that we can create case team member. We're saving this so label will be case team member clicking on save activating this. Now I can create a process builder. So name is case process. It will be called when I record changes. And we need to choose as case and we need to put the criteria so check status we need to check the status rather it is escalated or not. So I'm searching for the field status equals escalated. And status is changed. So if both the conditions are true, then this action will be performed. So this action will be calling a flow. So call, let's type call flow and here. So we need to refresh this. So again, I'm adding action. So if your flow is not reflecting so you can refresh your process. Yeah, here it is case team member. So we need to pass two things case ID and owner ID. So for both I'm choosing field reference. So first time passing case ID. Again, I'm choosing field reference for owner ID. So the case through which this process will be initiated so on that case. ID is available owner ID is available so both will be passed. So I'm saving this so both both values will be received through flow and further process will be executed. So now I am going to activate this. So all the things are done now. So if we move to our slide so we created case team role we added a case team related list on case page layout, then manage it is already available auto launch flow is created and process builder is created. So now it's time to create a case and then escalate this case. So I'm creating new case. I'm choosing record type case demo to because for this record type status pick list is having escalated field. So phone. So I'm saving this. So I'm logged in as a Sanjay Gupta so you can check it here as well. On my user record manager is populated as because right. So if I move here to related record. So here case team you can see zero members are added. Now I'm going to escalate this clicking on save. So here you can see automatically one member is added and that is because who is manager of my user. Right. Member role is available and case access we decided at the time of a case role creation if you remember this read write case access. So now on this case that we created right now the manager of case owner can do read write operations right. So if you are working in a wd where record sharing is private. So in that case this case team member creation is important because if a particular member or user is added to case team. Then based on this case access they can access a particular case and do the needful things. Right. And if you want to add members manually or add team manually so these two buttons are available here as well. But the in this video whatever I demonstrated you is the automation to automation we added member to case team whenever the case is escalated. Right. And the member is manager of the owner. So this way I hope you understood how we can add a member to case team through automation using auto launch flow. So you can implement this process in your org as well or maybe you can use this in your projects. So I hope you understood whatever I demonstrated and it will help you. And if you want to watch more Salesforce training videos you can go to description of this video and you will find links of various playlist there. Thank you for watching this video.