CodeLive – Custom Salesforce Notifications in iOS Apps

Just another WordPress site

CodeLive – Custom Salesforce Notifications in iOS Apps

– Hello everyone, welcome to CodeLive We’re starting a little bit late today because as it turns out, we’re having some difficulties with getting the streaming going But I want to introduce Aleksandra Zhulina Did I pronounce your last name correctly? – Yes, perfect – Awesome – Hello everybody – And let’s see, lets deal, just check in with our chat people here How about now? Question Mark When you’re having some issues, getting everything broadcasting And so hopefully this is going, we’re gonna wait just a second for our chat people to weigh in See whether or not we’re broadcasting Joshua, I see Joshua on there Joshua are we Can you see the stream going? We, maybe stream, okay Let’s do this Let me try and bring up the stream myself – I actually see it going on on the website – Oh you see it going on the website, okay, good – Yep – Okay, good So we had a little bit of technical difficulty there and that was fun and games But now we’re started today We’re gonna be talking about the notification builder API This is an API in a system that Aleksandra builds and helps build She’s one of the engineers on that team and we’re gonna be working through, what it is, how to use it and what are some use cases for it? So to start us off, we’re gonna start on what a custom notification type is And you were just giving this, you’re going great guest about that before we determined we were having some technical difficulties So I want try that again, Aleksandra – Yeah, sure So everybody now talks about notifications always because this is the best way to get the users engagement So custom notifications, they allow admins to send notifications to their users when some events in the system occur that they users can be interested in So you probably are familiar with custom notification from our Salesforce1 application course because Salesforce work Salesforce application already takes advantage of the custom notifications, now you can build mobile app that will be receiving custom notifications as well So to start with to actually create a custom notifications and a trigger custom notification system, we need to start by creating custom notifications type So what custom notification type is, is basically a marker for us that tells us what notification type you will be using in process builder When you create a process flow or an Apex when you use Apex to send custom notification So it’s up to you to decide whether you wanna use just one custom notification type and use it across all your notification needs If you don’t really see the need to differentiate between different types, or you can create multiple notification types, we recommend using multiple notification types Because in this case, you can actually take advantage of notification delivery settings, where you can enable different delivery types for different notification types So let’s go ahead and start by creating a new custom notification type So it is as easy as going to set up looking for the custom notifications node And here you have the list of custom application types in the system So we can go ahead and create a new custom notification type and let’s call it notify users It has a label, it has an API name And also the important part of defining custom application type is which channels you want to support desktop, mobile or both The desktop channels basically whether you want the authentication to show up in like in desktop, the mobile is whether you want this notification to be available for mobile applications And when I say available, it means that you just saying I support mobile And then for every connected application in your system, you can define whether or this application one preceded or not So I’m going to go ahead and create and save this custom notification And we, in this demo, we want to show you how connected, how mobile application can be created and the mobile application will be receiving custom notifications So I also will take a next step and I will configure the connected application for our mobile app to actually accept this custom notification So to do so I will go to the App Manager – So the notification type can be used by the connected app and the connected app specifies whether it’s available for mobile push

on Apple versus Android So I’m trying to just trying to put a picture together, 10,000 photo overview, we’ve got app notification types, which are where they’re gonna go to desktop or mobile and give it a name And then we also have the connected app, which specifies of these are subscribed to, is that a good way to put it? – Yes, that’s correct So basically if you want to think about it in terms of connected applications, so you know how, when you develop the mobile app, you’ll just start with the connected application, right? Because you need to authenticate with Salesforce You need to configure application to let’s say, receive push notifications and so on So this is one more option that you now have in your connected up definition to what we call subscribed to a notification types So I went ahead, and I’m editing my application now So if I scroll down, I will see the list of notification types that I available for my application So now you see that all three types that you saw in the list are available here I mentioned that if you don’t enable mobile then connected applications cannot use it So if I didn’t enable mobile for my notify users step, it would not trap on the list here – Okay – So I’m going to say that I’m subscribing to this type And what is also important is that I want to receive push notifications This checkbox send and push is only displayed is if applications configured with push settings So we can see that here, my application is already configured It’s an iOS application So it has some awesome settings for Apple custom notification service So this is why checkbox is available here, and I’m going to enable push and I’m going to save So this is basically all when it comes to configuring application to receive notifications on the server side But of course there is this big step to actually make application on the client, receive those push notifications and display them And this is what Kevin you will be talking about, right? – Yeah, but before that I wanna just I mean, let’s just be honest not every company is gonna write their own iOS app right? Or their own Android app So how would we go about configuring this to also work with Salesforce1? – Oh, that’s a great question So let’s say that your users use Salesforce1 application and you created this custom notification tab and you just want it to be sent to Salesforce1 So it is as easy as going to notification delivery settings – Oh okay – And then here you see all your custom application types So you can see that my notify user type that I just created it is already available for custom notification demo connected up which is the app that I just edited What I can do I can modify this type and you see that I have Salesforce, mobile apps installed in my work So I can enable this notification type for Salesforce mobile and save it and that’s it So basically now, if we trigger this notification in our org, and if the user has mobile applications Salesforce mobile on the device, then the user will be receiving push notifications – Very nice, very nice, okay So the flip side of this, because we’re talking about mobile push here is creating a mobile application So I have gone through, and I’ve looked at the I’ve done a little bit of pre coding here to set up a mobile application on iOS I wrote it in Swift, I like Swift and I’ve written it with some Swift UI interfaces, no big deal but the important part here is that we’ve created this application from the SDK template that comes with an encrypted notification service extension, which is a total mouthful But what this means is, whenever we get a push notification in iOS is going to say, okay, wait, there is some content that might change That’s called mutable content It’s a flag and we’re going to pause here and hand this push notification off to this custom extension we’ve written and that custom extension can do whatever and then display the notification for us And so what happens is we’re going to take this and we’re going to put it in this notification And that’s what I’m showing you here And we’re gonna write this one method did receive UI notification request with content handler And the big part here is that what we’re going to do is we’re going to call our handle notification method And our handle notification method comes right, comes into play right here, where we’re going to try and decrypt

the body of our message So let’s show what that looks like here in just a second I’m going to run this on my phone and it’s gonna build the suspense is killing me Is going to, and what I’m gonna do is I’m going to wake up my phone and I’m going to, I’m holding my phone in my hand you can’t see this, but I’m going to show you my screen We’re going over here And I’ve got some notifications on my screen here, but I should get my little app It hasn’t installed, oh here we go Here’s my little, the bottom corner there And so did it say that it launched, okay? We’re running notification, builder demo There it goes, now it’s launching And let me make sure you can see that on the screen Here’s here it is, I’m gonna allow this I’m going to login here And I’m gonna switch off this for security reasons So you can’t make fun of my password This is the exciting part Okay, and I’m willing to bet that this is gonna ask me for a verification token, what do you think? – Yeah – Verify my identity – You will take what amount? – All right, let’s do this I mean, switch back off here so I can read my little verification token And here we go we put this in, meet file, okay, and yeah, I’m gonna allow access And so the basic stack template app shows some users some contacts here, and if we can interact with it by clicking on one of them, maybe, okay maybe not I didn’t put a lot of effort into this part of the demo app obviously So you’ve got that there And if I put this in the background, because by default, we don’t wanna see the notifications, unless they’re coming in the app is in the background right? – So should I go ahead and configure the process to trigger notifications or– – Yeah, go ahead And well let’s send a test one so we can show what it looks like to get that encrypted and not handle it So let’s do this, I’m showing my screen, let me go into the org here and I’m gonna go to connected app And actually, I just want to add, I used to be connected apps and you could go in there and edit them And now they’ve moved it over here And I always forget, so custom notification demo, I’m gonna go into this and I’m gonna do edit I don’t think I wanted to do edit I think I wanted to view I did want to view – Yep view, all right and now that I’ve got this, one of the things that I really love about this interface is we’ve got for this platform, we’ve got to send a test notification And so what I’m gonna do is I’m going to quick here It’ll ask me which one I want I’m gonna look for the one that I did today, the 22nd at 6:01 There we go and I’ll put an alert, hello world And I’m gonna get that in background I’m gonna try and scoot over here in time to see it Hopefully show up it says it was sent Am I getting it? I’ve not yet gotten it, of course this is a live demo and that this is going as planned when we don’t get the notification It was receiving them yesterday So that’s good, now let’s try that again We’ll try this every time Come on notification Okay well I need you to take it on faith that we do get push notifications And that has been working for the past a couple of days here But the thing is, Salesforce is a secure application And so when RCK is also a secure SCK, and what that means is when we send a notification, one of these custom notifications out, you get the title and then the body is encrypted And what that means is if your phone is sitting on next to you at Starbucks and is locked and you get a notification that says, Hey, you just sold, I don’t know, 10 grand worth of paper products to whatever company, you may not want, that kind of detail showing up

right there on for everyone to see on your on your table, sitting next to you on the table So what we do is we encrypt it and then it’s only if you unlock your phone, that you get to see those full example, full details So I wanna go back to the code here for a second in X code And I wanna show you that this is the bit that we’re going to call to decrypt this content And I want you to know that I didn’t write a lick of this code All of this code was completely out of the template The template is boiler plate for that extension You don’t need to modify it unless you want to, because all we’re doing is taking it and decrypting that payload from Salesforce So for the rest of this, because it’s gonna be the more common use case, we’re gonna switch back to using the Salesforce1 application so that we can demonstrate what it looks like to get that encrypted payload, et cetera But for now, I wanna just draw your attention to, this is the only the real bit that I had to modify And somebody is gonna be asking in the chat, inevitably, where can I see the source code for this? I’m not gonna give you the source code for this application What I’m gonna do is I’m gonna point you at Force iOS, which is got the template, and it will spin up the application for you so that you don’t have to worry about certificates and all that sort of jazz to configure this So with that said, let me go back to our Salesforce instance here And we’ll look at what we’ve got going on in terms of our connected app We had to specify that this was for iOS And we did that by setting up the iOS platform key and certificate information, lots of detail and subtleties in that We’re not gonna go into it, but that is the sort of last required step to make all this work, right? Am I wrong? – Yeah – Okay – Absolutely – So now, we’ve gotten for lack of a better term, we’ve got something that we can throw at mobile devices and we’ve got our mobile device set up to catch those notifications How do we actually go about sending or throwing out that notification? – Yeah, this is the part that I love that you have many options to do this and this option Like some of them are very easy, like using process builders, some of them require accordingly ethics code So let me go ahead and start by showing you how easy it is to actually trigger custom notification from process builder So I’m going to go to the process builder in setup, and I’m going to create a new process And let’s say that I want to send a custom notification when opportunity changed? – So the idea here being, let’s say an opportunity is marked closed one or progresses in its stage – Yeah, we can have conditions that we want there So I’m obviously not very creative as names So I wanna start this process when the record changes – Okay – So I’m creating a new process And then I’m saying that I want the process to start when opportunity changes And then I have an option to choose whether I wanna do it only when the record is created or when it’s created where I edited And I want to do it when a record is created or edited And then I have an option to define the criteria, as you Kevin just mentioned, I can say, okay, I wanna like let’s say it’s stage, right? So I wanna send a notification when certain conditions are met – Okay – So I can say that I wanna send a notification when my stage equals needs analysis ’cause it needs analysis from somebody – Yep – Can we set it up so that it will fire whenever the stage changes? – Yes, I think that you can do that– – With a formula maybe? – And option yeah – Yeah that’s fine I was just curious – Yeah and I think there an option to do this easier than a formula – Okay, so we can set this up to fire – Yes and then the important part is now we are defining an action what exactly we wanna do? And in the case, we wanna send custom notification – And this is new as of winter 21, right? Or is it summer 21? – I think it was new in earlier, but basically, yeah So the piece that is you now

is that mobile applications can actually subscribe to receive notification And also the API that allows you to get the list of notifications is now publicly available So until now the only consumer of custom notifications was a desktop and Salesforce mobile apps So now it is available for all the developers So now I’m saying that I wanna send custom notification and I’m choosing what type I wanna use I wanna use my notify users type And here is the important part who is the recipient and you have different options You can send notification to a specific user You can send the notification to an owner The example of this can be that you have a case where the owner can be a user or a queue And you might want to send notification to the whole queue of users who is an owner of the case – And does that work with mobile push as well? Or is that desktop only for queue? – This is basically, it sends a notification to whoever users are on the queue So any user who has mobile device that expects those push notifications will receive notifications – So you could build an automation that would send this kind of notification to the queue whenever a case has been responded to by a customer, but not reacted by the queue where our user in say two hours – Yeah you can do it too So another option is to send a notification to a group Again, you’re sending to multiple users, or you can send notification to the queue, which again is another type of a group of users And if opportunity team selling is enabled in your org, you can send the notification to the opportunity team So basically that’s gonna be a team that is assigned to the opportunity So let’s say that for now I wanna just send a notification to the specific user So what I can do here, I also have options I can choose the user from a record And in this case, I will be looking for the user ID here So it can be the owner of the record It can be some user ID on some other fields on the record, or I can also send a notification to the current user So this is option that is basically It’s a user who is making action So if I wanna send myself sort of a reminder that something happened not myself, but the user to the user who is making change, or I can send the notification to a specific user So let’s say that I wanna send it to Kevin So I will just choose Kevin as a recipient of notification – I feel like I’m gonna get a lot of notifications (laughs) – You probably will So now the next step is to define the notification title and notification body This is basically what the user will see So you can either just type the text or you can also put some merge fields in there, so you can put some details like amount and then you can find amount here and choose the merge field And let’s just stop right there So basically you have some title and you have some body where you can put information that includes data from the record, or it can also include the data from the related records You can use this merge field selector to actually drill down to some related records And the target object here is preselected for you So the target object is basically where the user will be taking when the user clicks on notification on desktop, as for the mobile implementation, it’s up to the developer what to do with that normally, I guess this would be the same behavior expected When notification arise you tap on notification and that takes you to some place where it will tell you more about what happens So this target ID can be used, for example, to make another API call, to get details about the opportunity and display the details in some nice way, or maybe something else that you want a user to see or to do So I’m going to go ahead and save this process, and then I’m going to activate it – And this should also send to the Salesforce1 we’ve configured that already, or the Salesforce app, right? – That’s correct, we did So I’m just reminding myself that the condition that I set was stage equals needs analysis So now I’m going to go ahead and go to the list of opportunities – And I’m gonna switch over to my screen so we can see my phone, which we’ve wired up here on the screen, ready to receive this message when it comes in – Okay – Okay, so I’m going, I wonder if Kevin,

if you gave me access to edit your opportunities or if I should create another one – Go and create another one I hadn’t thought about that’s a good call (Aleksandra laughs) – All right to I’m going to create another opportunity with some close date and now am puzzled what to name it? Very creative – Yeah name, it widgets (Aleksandra laughs) – So, and we put the stage need analysis, I’m gonna save So did you get your notification on desktop? – I did I got the notification on this, and you see how it’s locked here, right? Up here you can see that it’s locked I’m gonna now turn it to my face and let it unlock And you’ll see how it switches from notification to the payload we have Opportunity has changed amount 10,000 Pretty cool, now, if I were to lock this again, You’ll see that it goes back to just that title or that just that notification, which is exciting to me I like the fact that we have it encrypted notifications That’s probably like, that’s what excites you about this, but yes, that’s what I find exciting So that is our Go ahead – Yeah maybe I should mention another security feature since we’re talking about being able to hide certain things if necessary So if you go to the list of installed applications in org and– – You gonna show us yeah here we go – Yeah, I’m showing it right now So these are all the applications that are created or installed in the word And let’s see that I have the Salesforce iOS application here So if you look at the details of the application that has this chat box here, display full content, push notifications, and what this chat box means is that I actually want the title and the body of notification to be displayed when the device is not locked However, I might be an admin who thinks about Okay no that’s not something that I wanna do I actually want to use it to see the details of the notification when the user is on app, but I won’t push to only include the short title, just like some summary that I will put there So in this case, I can just modify the setting on the screen And then this case that’s as easy as modifying it Like I’m checking it, saving And then on input notification, you will only see notification title – Unless I, and then I have to click on it to open it? – Yeah and then you click on that, then it will open the mobile app And if you go to the notification threads of Salesforce mobile you will see both title and a body there And then again, you can click on the notification there it will take you to, in our case, on our example to the apartment – So I’m gonna click on this and you’ll see that it takes us into the Salesforce app And of course, it’s logging me back in And when just talks about the notification tray, that’s this little bell shaped icon as number five up there And here I can see the various notifications that had come up I did get the notification in the desktop as well, but I just thought I’d show it here on the mobile app – And you’ll probably think that it’s been there forever, a Salesforce mobile had had but what we are now saying is that everybody can build that tray Everybody can receive push notifications on a mobile device, the same way that Salesforce application receives – That’s cool I like that a lot Now let’s switch topics here a little bit, and we’ve seen how to do this, how to send these notifications with process builder And I’m gonna show you how to do it in code now And you may be thinking, why would I want to do that process builder it’s so simple I click here I type in a few details in there it goes, I’m not entirely sure I’ve got a good use case for doing this in Apex You might have very complex conditional logic that you wanna figure out who to send the notification to It may be that you also have, like, I don’t know your company policy is to do things in Apex first I don’t know why you’d do that but that could happen So what we’re gonna do is I’ve created a class here, notification builder, and I’m just going to, we’re gonna do a nice public stat We’ll do public static void, Y void I don’t think we’ve got anything to return here and we’ll do send notification to, and we’ll do opportunity team and we’ll do ID opportunity, actually you know what?

I’m not gonna do ID ’cause I want to make sure that this is an opportunity So I’m gonna do opportunity, all right? So rather than just dealing with your ID And now I know that now only you have an ID of the opportunity ID, I have an actual opportunity and it is an opportunity ID So I can I don’t have to worry about casting that or doing a lookup on the ID preference to check it And so now that I’ve got this here, we’ve got a little bit of code to play with It’s only about six lines of code and it’s kind of boiler plate So what I’m gonna to do is I’m gonna show you the boiler plate way to do this And then we’re gonna dice it up a little bit with some refactoring So the custom notification class is part of messaging So I’m gonna do messaging.customnotification We’re gonna creatively name this notification We’re gonna say new messaging custom notification And I’m just gonna do the blank constructor There is a constructor you can use that has basically all the different options You can cram it in a little one, but for right now, I’m going to do the basic one So notification., and we’ve got some basic ones we’ll do set title and what do we wanna call our title? – Something happened – Something happened Okay so we’ll do something happen as a title Then we’ll do a notification.set body And since we’ve got that opportunity object here, we can do any kind of merge fields we want So we can do an opportunity named and we’ll do plus And then we’ll do changed new stage is Then we do this again pop.stage, not capitalized stage name that And then we’re gonna have to set the type ID So notification.settypeid And it’s actually not that it’s set notification type ID and walked pass into an ID here, which means we have to go get our type So let’s do that here we’ll do this at the beginning, we’ll say custom notification type is that the right? Is that the is it notification type or custom notification type – For the object it’s custom notification type – Okay, good We’ll do C and T customer notification type equals and we’ll do select ID developer name from custom notification type where developer name is equal to And what are we did what was on of ours is Something happened– – Notify, – Notify you — – Yes it was to notify you sorry that it double check that – It’s a underscore right, notifying a short user – Yes – That’s what I thought – It is not notify capital N underscore capital U users – Okay, so what you see there on the screen is right? – I will see it in few seconds – Yeah I forgot there’s a little bit of delay (Aleksandra laughs) – Notify users (mumbles) – Notify users, so we got that there No down here, what we’re gonna do is we’re gonna say notification type is equal to And actually we’re gonna do is I’m gonna use the safe navigation operator to make sure that we got a value back from that So my favorite little question mark there, and it’s actually ID, okay? Where are we squiggling that come on All right, so now that we’ve set our notification ID, we need to set the target, set target ID Now the target ID is one of two options available to you You can either set the target ID or you can set the page reference Now from my work with this, I noticed that the set target ID will let you navigate to a record, a particular record And the page reference is a little bit more flexible, but a little bit more complex as well

Because the page reference requires your app to implement how to interpret that page reference Is that a fair assessment? – Yeah, that’s right So basically the lightning desktop will handle page references, but for your application that you’re building, that’s gonna be more tricky So the target ID, we assume that’s gonna be the record ID of the record that users should be interested in – Yep – So it should be pretty easy for the opt to implement some meaningful logic there – So for this case, I’m just gonna use the target ID because when I was send this notification and we open it in Salesforce1 I want it to go to the opportunity in question So we’ll set the target ID to the opportunity, and then now we can send it, now, when we send it, we have to provide a list of users or a group ID or a queue ID or an opportunity team And so we’re gonna to do this to the opportunity team So we’ll do notification.send and we’ll do this requires a set of IDs So you can imagine if you were collecting a bunch of different ideas from different people, through a decision tree, you might have already created that set and started adding things to it But I’m just gonna create a new one here So a new set of string – And then I’m gonna use the constructor format that allows me to pass in something intelligent And what I’m gonna do here is I’m gonna do Now you may be going, well that’s not a valid, opportunity team ID and you’re right But in this particular case, if you set that opportunity, it will send it to the opportunity ID team That’s how it chooses it’s sort of route decision on the groups there So here we’ve had to do is we’ve had to look up our opportunity notifications or contact notification type and we’ve had to build the notification Now, like I there is the option of using the all-in-one constructor where you say title equals and that sort of thing But this is a little bit more expressive I’m gonna go ahead and save this Let’s see if I’ve got any typos anywhere The suspense is killing me here Come on, come on, come on, deploy, deploy, deploy, – All right, I have no typos Okay and so what we can do now is I can run, execute anonymous and I can pass in this function name and the opportunity ID So Aleksandra let’s find an opportunity ID here So I’m gonna go to sales, nope, no I clicked on service I don’t want service, I want sales – And you need one that has the opportunity team – which I have gone in and pre-configured all of my app if I create an opportunity to automatically, how’s my opportunity team So if we scroll down here you’ll see that I’m on this opportunity team so as Sasha And what I’m gonna do is I’m gonna just highlight that particular ID and I’ll go over here And this is I don’t know if you’re familiar with this, this is one of my favorite tips and tricks of visual studio code I can type some code, so notification builder, and I’m just gonna go down here for syntax highlighting down at the bottom it just plain text If I click on that, I can choose anonymous Apex So now it’s gonna start giving me syntax highlighting I can do all sorts of that stuff I’m gonna figure out what my name was to send notification opportunity team Notification opportunity team And I’m gonna say, I need an opportunity here So let’s grab that first, select opportunity is equal to select ID, stage name from opportunity where ID equals that So now we can pass in our opportunity here, and this should fire off our method And the way we do this, we run this We just hit the command palette And this is my thing that I thought was my favorite is one of my favorite things about visual studio code Now that we’re getting back to it, I can do anonymous and hit execute anonymous Apex with editor contents So enter under there and down here in the output, we can see that execute anonymous failed Let’s figure out why? That object row was retrieved for the (mumbles) without querying the requested field opportunity name All right, so we know that when the opportunity comes in here We’re gonna need the name and we’re gonna need the stage name, et cetera

So let me go back over here and we get stage name We put a name that, and now I can run that again Execute anonymous, that’s there, okay? And it sounds like somebody got a notification – That was me – That was me I got one too here let me go over here Hey, something happened an opportunity named test opportunity changed theirs here’s my ID, the decision-makers Now, as I said, a lot of this is boiler plate So let’s do a little sort of intelligent refactoring here I named this notification builder because we might want to reuse this for multiple types of notifications So let’s do this We’ll do private static void So this is gonna be internal to this class And we’re only going to be able to use it here That’s fine we’re gonna do send notification and we’re going to need a notifications custom notification and call this notification and we’re gonna need the target and we’re gonna need the recipients So we’ll do set string recipients and we’ll do target ID, we’ll do ID, target ID Now with this in place, we can actually do this part, drag this down here And this is just gonna be our recipient list Okay and we’re gonna pass in that notification So we have the notification there got the recipients and the target ID actually, we don’t need the target ‘Cause we can construct that So we could actually, this turns out to be a whole lot less interesting of a refactor And then I thought since we refactored exactly one line out, and now we’re going to add another line, which is to say, send notification So let’s think about how if we want to be able to do that anymore So we basically, what we’ve got is a method, to send it to the opportunity to team, ’cause that’s how we’re setting the target ID, but we could generify this and just say target ID or here, I’ll just do this, public static void send notification with target We’ll do string title, string body, ID target And now we can do this here, stand here, replace the body method with body, the title with a title and oh, okay, here we go And for the notification ID, we’ll just set this to target I’m sorry That is our contact ID, custom notification type ID And then this would be the target So where are we gonna get this contact here? We’ll have to pass in that somehow And again, this is a refactoring, as I’m thinking about this on the fly and realizing, “Hey, guess what we’ve done?” We’ve now implemented a custom constructor that we’re good just fill it in here So let’s just can this here, these two things, and we’ve got this example code, what we can do with this What are some other use cases that you can think of for why we might want to send this, to send notifications out Sasha do you have any ideas on other reasons you might want to send a notification – From my picks or in general? – In general – Well, the like basically the most common use cases are record changes, right? So any conditions on any fields that might be of interest or user, it can be also that you, as an admin, just want to notify users about some of that happens And because at the end, this is a vocable action API and Apex uses this API wrapper for some notification So you can build the page basically with a send button to like, I wanna send a notification to a specific user – So could we build a button that would,

I mean, obviously we have five minutes left, we don’t have time to due today, but in theory could you build a messaging interface that allowed you to type a custom message and then hit a button and send that message to a user? – Yeah, you can absolutely do it And it’s probably worth mentioning that besides the process builder and Apex you can also send custom notifications from the flow builder and flow builder actually allows you to build a screen and a flow So you can have some kind of a flow where a user goes through the screens And at the end, there is a notification that is being sent to the list of users – That’s cool, that’s fancy – Yeah – That’s very fancy so people may not be aware of this chatter messages automatically get pushed is that true? We’re fire a notification – Well it’s, I would say that it’s the other way around So when chatter message is being posted that then the notifications are being sent for things like at mentions or posts or comment – Okay, so let’s see, do I have chatter on this page? So if I just go in here and I share an update and say, hello, everyone, and I share it, I shouldn’t get a notification, right? I would have to build that in notification builder in the process builder flow But if I were to do like, hi, then you would receive a notification – Yeah – Hey, there it is, I like this you heard your feedback – Yeah, exactly – Okay – Yeah, that’s exactly right So basic basically chatter I know that a lot of developers use chatter actually as a workaround because they could not send custom notifications before That was their way of sending a notification to a user about anything, because there was an action to actually post to chatter So they would instead of sending something like to custom notification they would make a post and they would at mention the user that they want to define, put some texts there So that was a workaround Now there is no need for this foreground anymore because we can just send custom notifications – Yeah and Mark is actually telling us that calling it in a flow is gonna be more useful He’s noticed that if you try to build these out in process builder, there’s some difficulties in pulling in variables from related records So we’re not diving too deep into that and trying to replicate the difficulties It seems like and flow’s give you more flexibility So I’m gonna encourage everyone to start with flow – Absolutely flow gives you more flexibility And between Apex and process builder, it’s a sweet spot because it has a visual interface So you don’t really have to write code, but at the same time, it gives you much more flexibility There is a limitation on the process builder that people could try to already notice that the recipient is only one ID So you can send to a group, you can send to a user, but it’s one group, one user, both in aid, et cetera, and flow you can actually build a list of groups, list of users, list of owners So that’s something that gives you much more flexibility than a process builder And there are other things like Mark mentioned potentially is that like getting to the certain fields on a certain records is much more convenient and much more flexible and flows – So you might use the notification builder in flow to say okay, I’m gonna look at what, say the stage of this opportunity to switch to And if it’s closed one, then I’m not only gonna notify everybody on the opportunity team I’m also gonna take the opportunity to look up their manager and send them a notification and say, “Hey, go give so and so a pat on the back, “they did a great job,” or send It’d be great to come to add this to the component that gives you confetti on the screen You know what talking about like opportunity closed one Everyone gets a notification and you get the confetti on your screen I love it, all right well– – Yeah, that’s a special request – We’ve got two minutes left and I’m gonna open the floor for everyone to ask questions here Again, sorry we’ve had a little bit of the technical difficulties here at the beginning Anybody wanna ask any questions or give any snide comments or give feedback there and the chat feel free In the meantime, I wanna thank you Aleksandra for joining me today This has been good times good times– – You are very welcome – Good times and a special thanks to the mobile SDK team who helped me doing some debugging this week on the demo app that I was writing So that was good times with them too I’m not seeing anymore feedback or questions So I’m gonna give it, we got like 30 seconds left So with that, I’ll say thank you very much

And thanks for tuning in We’ll see you again next week on CodeLive – Thank you and everybody have a good day