 Hello friends, I am Sanjay Gupta. I welcome you on Sanjay Gupta Tech School. In this video, I'm going to demonstrate you how you can send custom notification through lightning flow in Salesforce. So this is the scenario that we are going to cover in this video. So whenever a case is escalated, we need to send custom notification to the manager of the case owner, right? And what we need to do for this, we need to create a custom notification. We need to set the manager on user record. Then we need to create auto launch flow that will be sending custom notification and to call auto launch flow, we will be creating a process builder. So these all things we need to create step by step. So before starting, if you want to watch more Salesforce training videos, so you can go to description of this video and you can find links of various playlist. So now I'm starting the demonstration. So first of all, in setup, you need to search for the custom notification and you can select that. So in my former demonstration, I created a custom notification while I demonstrated sending notification through process builder only. So this is the notification that I created earlier. So I'm going to reuse it. If you want, if you don't have any custom notification type in your org, so you can click on new and you can fill the name and API name and you can select the supported channels as well. So custom notification is already there. Now I need to search for the users. So right now I'm logged in as Sanjay Gupta user. So I'm going to check whether manager is populated on my user record or not. So here you can see this is my logged in record. And manager is Vikas Gupta, so it is populated. So in your case if user is not having any manager populated so you can go to user record. Click on edit. And if you scroll down so here you can see manager lookup is available so you can choose a particular user as a manager. Right. So in our flow we are also going to check whether user record is having manager or not so that flow doesn't fail. Right. So these two steps we completed. So custom notification is already there. We checked manager is on user record or not. Now I'm going to create auto launch flow. So I'm going to search for flow. So from here I'm going to create new flow. So flow type will be auto launch flow because we can't choose record trigger flows because we cannot check it is change condition in that. So for that purpose I'm choosing auto launch flow and is change condition we are going to check in a process builder so that unnecessary flow won't be executed. So I selected auto launch flow. Now I'm going to create two new resources as a variable. So first is case ID. So this will be of type text and it is available for input. So we are going to receive case ID from the process builder. And one more resource I'm going to create that will be owner ID available for input. So these two values will be provided by the process builder. So we have case ID owner ID. Now I need to query owner record. So I'm choosing that record element that case owner details object I'm going to choose as user. So why I'm going to query user code because I need to check whether manager is populated or not. If manager is populated then we are going to use that ID so that we can query manager details. So we need to apply a condition. So ID equals owner ID and automatically store all fields only first record so this we need to use as it is so get record is available here now I'm going to apply a decision. So we are going to check manager on user record is present. So if manager is populated then only we need to execute the flow. So now I'm choosing this get case owner details dot manager ID. Then I'm choosing is null falls. So if is null is false or manager ID is null falls it means it is populated so I will be using that for further process. So we have manager ID for which we are going to for which a user we are going to send the custom notification. Right. So now next I'm going to query notification type. So get notification details. So I hope you remember the notification custom notification we created. So here I am going to choose custom notification. Sorry, custom notification type object you need to choose. And here you need to apply a condition so developer name equals. Now I need to use that developer name so escalation message I'm going to use. Now, yeah, I'm leaving it as it is like only the first record and automatically store all fields clicking on done. Right. So if manager is populated on the user record then only we need to send the custom notification. So if manager is populated then we are acquiring the custom notification details now from action. I'm going to search for send custom notification. So send some notification it is label and API is by default populated. Now here I need to put the custom notification type ID. So this I already have. So, so this way I used it custom notification details dot ID. Now body I need to create. So I'm going to create new resource as text template where I can type some data. So notification body. And I'm going to use it as plain text. And I can also put details of the case. So for that I need to query a complete case details. So right now I have only case ID. Right. So I'm just typing the message if you want to merge the fields then you need to query that record as well. Hi. Case is escalated for your reviews. So this is a test message that I'm putting but we need to mention the case number as well. So I'm going after this I'm going to tell you how we can do that as well. So I'm clicking on done. So notification board is body is available here. Then I'm going to create notification title. So text template notification title. And escalation notification. So always remember to choose view as plain text. So that only plain text will be displayed there. Don't use rich text because it shows HTML tags as well. So both notification body and title I have created now recipient IDs. So remember here we need to pass the list. So we have only one manager ID but we need to create collection for that. So I'm going to create new resource as variable. So notification IDs data type. I'm going to select text and choose this allow multiple values. Right. So I'm choosing this one then target ID will be our case ID. Right. So this way I populated all the required fields here and I'm clicking on done. Right. Before this now I need to use one assignment so that I can put notification IDs. So notification IDs dot add. And we need to add the manager ID so that we have in get owner details. Manager ID. So the owners manager ID will be added into this collection variable and that we are going to use in custom notification. So assign manager ID. So this way, first we receive notification details then I assign manager ID to a collection variable then this action for sending custom notification we have created. Now I was telling like how we can receive the case details so we can have one element get record so get case details. And here we can choose case. So as process builder will be passing only case ID so with that case ID we can choose or we can query complete case details. So here you can put case ID. And all the details will be available here in this variable get case details. So now if I move to that text template. So in notification body I can pull that merge field so here I'm going to choose that get case details dot case number. So I'm going to put it like this. So now high case and then case number will be displayed is escalated for your reviews. So this way you can merge a particular field related to a record. But before using that you need to query that record so that particular field value will be available. So now I'm linking it with this. So first case details will be queried then owner details then after receiving owner detail we are checking whether manager is populated or not. Then we are receiving notification ID then we are assigning manager ID to collection variable then we are creating this action for sending custom notification. Right so this way this auto launch flow is ready to use. So I'm going to save this naming it as notification flow clicking on save activating this. So third part is completed we have created auto launch flow now I need to create a process builder. So moving here. So I'm going to create a process for case object. So naming it as case process and whenever a record is changing changes. From here I'm going to choose case object when record is created or edited. So here you can see case object is available now I'm going to apply the criteria. So check status. So here I'm going to choose the status field is equals to escalated. Again I'm choosing status field and I'm putting is changed. So if these two conditions are true if value of status field is escalated and status is true like is is changed is true for this status field. You have modified the value of status field from any other value to escalated. So in that case only we need to call that flow. So this we cannot do in flow right now because that feature is changed is not available. So now I'm going to call the flow call notification flow. So we need to pass this and we need to pass two values in this flow. So first one is let's say case ID field reference. So I need to pass ID of the case through which this process will be initiated. So I'm selecting case ID choose so case ID will be passed. Then I'm going to pass owner ID. Again I'm choosing field reference. So here I'm selecting the field as owner ID. So both case ID and case owner ID will be passed to the flow. So this way all things are created. Now I'm going to activate this right so all four things we have created. Now I'm moving to case object. So right now I'm logged in as Sanjay Gupta which will be the case owner. And after creating a case I will be escalating that case. And then I will be logging as Vikas Gupta and you will see your custom notification will be there. So I'm going to create a new case. So I'm choosing case demo two because on this record type I have that escalation escalation field on status. So the escalation value on status field. So choosing case origin as phone leaving all fields as it is clicking on save. So here you can see case 1034 was created right and now I'm going to change the status. So this is completed. Now I'm going to search for the users because I need to log in with Vikas Gupta so that we can see whether a custom notification is sent or not. So I'm logging in as Vikas Gupta. So here you can see this one is indicating that we have one notification. So I'm clicking on this. And here you can see it is showing a message high case. So here you can see case number is also mentioned. So it is basically displaying rich text because while I modified that text template having merge field. So I forgot to change that to plain text. That's why it is showing these HTML tags. So here you can read high case then case number is 1034 is escalated for you for your review. So this is the notification body and at the top you can see escalation notification is the title. Right. So let me log out and show you that text template so that you can understand how you can modify that. So now I am in the flow notification body. So here you can see now it is showing you as rich text. So I'm selecting plain text and I need to remove these HTML tags. So as I remove these HTML tags and I am choosing plain text. Right. So I'm removing all the tags which are available with this. And I'm choosing you as plain text clicking on done. Clicking on save as activate. So for understanding I'm going to create one more case so that I can show you the changes. So origin is phone clicking on save. So this time you can see case 1035 is created. Again, I'm going to escalate this case. Clicking on save. Logging in as Vikas Gupta. So now you will see that notification message won't be having any HTML tag. This way, I hope you also understood the difference between plain text and rich text. So don't use rich text while using text template always use plain text. So here you can see the difference. So below that is three minutes ago is having HTML tags which is for 1034 but this latest one a few seconds ago is having high case 103435 is escalated for your reviews. So it is not having any HTML tag because we used plain text in the notification body. Right. So I hope this way you understood all the things which I demonstrated in this video, like how you can send custom notification through flow. So I also demonstrated you some features related to flow like how we can get the records for case owner like user or notification detail and how we can use this action for sending custom notification. Right. So this way I hope you understood whatever I demonstrated in this video related to sending notification custom notification through lightning flow. So if you want to watch similar kind of videos so you can go to description of this video and you will find links or various playlist there so you can follow them as well. Thank you for watching this video.