logo

NJP

Mobile App Academy: Mobile App Academy: Building a Custom Mobile App (Part 3) - Push Notifications

Import · Oct 04, 2022 · video

good morning everyone and welcome to mobile app Academy this is our live building Series where we show you how to build and configure mobile apps on the now platform my name is David ha and I'm an outbound product manager here at servicenow and I'll be your host for today's session and I want to give you a warm welcome for joining us here live today if you are joining us uh for the first time welcome to the session our product experts are here to provide guidance best practices and answer any questions that come up along the way and we do host these academies every two weeks at 10 A.M Pacific in which our recordings will be posted to YouTube on the servicenow now Community Channel and just to point you to a few resources that we do have available if you're new to mobile we recommend that you check out some of these resources such as our mobile guidebooks white papers that can all be found on our mobile community site and we do have a plethora of other resources such as our labs and mobile trainings on now learning and then our past playlist to all previous app academies where you can find sessions like mobile agent quick start guides getting started with now mobile and I believe now for over 40 other academies as well and if you do like sessions like these um our servicenow teams do host to other academies such as the HR Service delivery platform Foundation platform analytics virtual agent and many others and you can find these Series in their respective communities by navigating to the community form tabs okay um and just to remind you uh on the agenda for today's session this is the last session in our three-part skill building Series where we show you how to build your own custom apps from scratch um and again this session we will be playing a pre-recorded video due to the fact that there are so many moving configurations and parts and we just want to make sure that all these configurations can be done um and captured within a 50-minute recording uh but we will definitely take any questions that do come a long way okay so this is our um part three in our Series in which we will now be deep diving into push notifications part one was how to define your data and build screens part two is how to build functions from scratch and now this very last piece we're going to be covering push notifications and for push notifications today we'll be covering how to build your push messages push layouts and links and how to um uh cover common troubleshooting tips as well and just a reminder that we're continuing to build a custom skills management app from scratch last week Ian built some actions that allow your agents to manage their skill sets and this week we'll be creating push notifications that will trigger anytime new task or sign to agents that's associated with adding new skills to user okay and just a quick reminder that we are building this on a San Diego instance and the goal here for with our series is to teach you the fundamentals on how to build push notifications from scratch that way you can add them to your own apps using mobile Builder um and we will be posting an article on community after the series ends with all the different update sets so if you want to access the data that we use to build um the series um then you can leverage that with for your own training and that's going to be available on the community as well okay but with that being said I'm going to go ahead and get started I'm going to do a new share now and start the replay of this recording okay so before we get started with the configuration let's just do a quick review of the components of a push notification on mobile if you look at this picture here you can see that within the servicenow client we have the notification record that shows up this is the push notification message content that's going to drive this this is what's going to allow you to build a layout for this list of notifications in the mobile client and also Define the link that the user is going to get to in terms of the screen they're going to get to when they tap the notification the push notification message itself is going to be the actual message that gets received so within the devices Notification Center so it's just important to understand that we need to build both of these as we create our push notification okay so let's jump into our instance and go ahead and set up a new push notification so you're going to want to make sure first of all that if you type push into the navigation filter here that you look for the push Options under system notification rather than system mobile so I'm going to click on create push notification because that's what I want to do so just thinking back about our app we have the ability to create a new skill and also we can identify that we've learned a skill and or already have a skill and that's going to create a task for the approver that we Define which by default is going to be our manager so we'd like this person to know to be informed that they have something to review so let's create a push notification for that so we can call it um skill requires review and we can select our mobile skill submission table for the when to send this could be assigned to the approver based on an existing task being updated or when we create a new task it goes straight into review so I'm going to select both inserted and updated for that situation and for the condition I'm going to select where the state changes to in review and also it's possible that the assignee meaning the approver reassigns this task to someone else so in order to capture that we'll add an or Clause here and we'll see where the state is in review and be assigned to changes so that should be good for a start for our when to send the who to receive we're going to want to look for users groups in fields and select that assigned to field and then we get to our what to send so we're going to need to create a new push message for this so we can click our lookup and click new to select a new push notification message and we can call this skill to review notification message now for the app this one is important because we're going to need to tie our push notification message to this specific mobile client that we want to receive the notification for so in this case we're using the agent app so if we were to start typing here we have our so just type service now and it's going to give you the request application or the mobile application or the classic we want mobile application because that's the agent client request would have been now mobile so we'll select this and for the table we're going to again select our mobile skill whoops mobile skills submission table and the push message content will get to in a minute that's going to be where we're going to define the the actual layout of that particular push notification but we can go ahead and make the message and I'm going to copy and paste here something like this so skill review task and we can add the number has been assigned to you and we can also include the state and short description which should be the new skill name or the skill being reviewed um so let's go ahead and so we can't click the lookup right now for the message content um however we can do that after we submit so let's go ahead and submit that and then we'll also right click and save on our notification record and once that's saved we can go ahead and open it and click on it and click this preview selected item information icon to open the push message so we've got our message here we set up we need to do our push message content now so let's do the lookup and click new make this a little bigger for us and we can call this skill to review message content and again our push app we type service now we can select servicenow mobile applications so we get agent and here we're going to open this up a little bigger because I'm going to paste in a script here that we can review together and we'll also include this in the chat as well as in together with the recorded video If you're looking at that so here we got our push message content here so let's review how this works first of all in order to build our layout for the push message record that's going to show up in app we can use our notification layout field generator class which is available and in here we're going to give an identifier so you know that's going to be the number of the task in this case in the description we'll use the short description from the record and also a state which is going to be our in review in this case next we're also going to need to build our link to the actual record and for that we need to know two things really we need to know the mobile client type so in this case is Agent so we're just going to set a variable client typed agent and then use it for our mobile deep link generator later on the second thing is the screen ID so this is going to be the screen the sys ID of the record screen that a tap from the notification should take us to so and how I got that very simple I'll show you in a second because we should really save this before we move away from this record once we have those two pieces of information we need to use the Deep link generator in order to create that link from the notification through to the screen so the function calls we're going to use is get form screen link I'm going to pass in that screen ID we're also going to pass in the table name which we can get from the current object the sysid which we can also get from the current object and um since we opened this deep link generator with the client type it's going to know that it's for agent this last bit and is how the layout is actually created so we can configure the sound in this case we'll we have a default sound the link is going to be the link for here from here that we generated using mobile link generator and are will add to our layout these fields that we generated using our layout field generator in this case the state and the identifier which again is going to be the number for the task so let's make sure that that's saved for now and we can close out of this pop-up and this didn't save into our field here but we can make at it now that it's actually been created and right click save now as I mentioned earlier we're going to need to review how that sysid for the screen is determined so basically what we need to do is we look back at our app and look for example at a skill so I tapped on a skill from the skills I want and so this is indicating to me that the name of the screen the skills I want record now it's probably not the final production name that we'd go with but it helps us to navigate around while we're learning the app so if we were to find the screen either in our platform view or for example in mobile app builder uh we can click our overflow icon and open that in platform to jump to it and from here we can copy this this ID so if we click back to our push notification message content this should be the same number same society and it is okay now the next thing we need to do before we do a test within the app is we need to make a conscious decision as to would we like users to have to opt in to this particular push notification or do we want them to receive it by default what I mean by opting in is if we look at our platform View and open up our profile and preferences from here we can get this pop-up menu here that's going to allow us to get to our notifications and if we look at our core UI tab for our notifications we should be able to see once this loads that we have a new skill to review push notification which is here skills requires review and if we open this one up we can see that by default here these aren't checked and under servicenow mobile application I could as a user check this to indicate that I want to receive this notification however if we want the users to receive it by default as most of you likely would we would need to go into our push application record which we can find under push application in the navigation modules and the one we're looking for if we look at the display name again is servicenow mobile application because servicenow request application is now mobile and this one is Agent so if we open this up foreign we should see a related list here for push default registrations and push message contents now the specific one that we added should already be here under push message contents which is great but under our default registrations that's where we're going to need to add a new record because we won't find it here by default if you don't have this related list by the way then you can just right click configure related lists to add it in there and look for push default registrations so if we click new here and look for that notification skill requires review and submit this now at this point we should have all the basics set up for a push notification to work so let's test it out within the app so probably the easiest thing to do here would be to go back to our main screen and we'll just tap on our quick action to create a new skill and in this case I'm just going to put the user that I'm currently logged in as as the approver just to make sure that I can receive this notification without having to log out and log back in again so let's get next click next obviously it's not a real test if I'm putting myself in the as the approver and in fact we might want to add something to our action to prevent somebody from doing just that but it works well for the purposes of our unit testing right now so let's make our skill here push notification master tap next and we can give it a description like watch the mobile Academy so therefore knows everything and we'll go ahead and submit this now this skill a new skill is pending review and so at this point we should receive the push notification shortly on the mobile device now if we don't there's a few things that I would suggest to check so first of all if we look at the system properties says underscore properties dot list in the Navigator and look for push glide.push.enabled should be true um so that's that's one obvious thing to check another is to make sure that you've logged out and logged back in uh for that user on the mobile device and a third thing to check probably the best thing to check related to push notifications would be to look at the push notification log here so if we click on this we can just add to here are updated and updated by so we can make sure we're looking at the most recent one as the push notifications are generated and go out we should see the um these go out into this log and we should be able to click on these records and see what the payload was and what platform it was sent to so in my case Apple here what application it was for so again the agent app and what is the type um meaning is it a failure is it pending or is it success So based on the fact that it's success here this is telling me that it has gone out to Apple to be able to send to me now sometimes these push notifications appear almost instantly and other times they can take a couple minutes to come into the device um so that appears to be what's happening to me here so while that's waiting to come in I can just show you a trick to look at the payload in a little nicer format so what I often do is I will select this whole payload and just open up and Google search for Json lint and this is a website where you can just paste in a Json object and validate the Json looks correct and then also take a look at that in a lot more nicer format so I can see what my alert body should be and I can look at you know the device token the layout make sure the instance is correct look at the link that comes in and the mobile request ID so I can see now that my push message has gone has come in so from a device notification perspective I can see I just made the my notifications persist so it would stay on the screen if you tap and hold on it it would show you the entire text of the message so in this case it's just everything that I had under push message and if I was to look under more I can tap through to my notification screen and I can see that I have a new notification here that's unread I can see the across the top my layout in terms of putting in the state and the number how many seconds ago since that message was received and of course the the message itself if I tap it then I'm going to be taking uh directly to that particular record and so reflecting back on our Target for today we were able to understand the difference between a push message or the alert on the device and the layout of the actual notification record within the client we are able to fully build out a message including a layout and link to the record that the user needs to review and we were able to do a little bit of debugging and understand how and where we can look if things are not quite working as they should and at this point after three relatively quick sessions we've been able to build out the basics of a mobile app including screens and sections and functions as well as push notifications to round it out and with that I'll send it back to David to wrap things up and take any questions so that pretty much wraps up our three-part Series in our custom map building series um Ian's taking us through um an entire custom app and hopefully you found that helpful um I'm not seeing any questions roll in at the moment so we can probably wrap up this is a very short Academy today but just want to fill you in on our next Academy agendas um we're gonna now start in our next few academies we're not going to start exploring how we can update the latest San Diego features to improve your mobile apps so if you actually want us to explore any specific topics a great way to uh share feedback with us um is to let us know in our post session survey I did see one question roll in on asking about doing a deeper dive into um mobile filters I do want to point out that mobile filters is going to be revamped and we noticed that it um doesn't quite have everything that you would need to completely configure it so we've filled in the doc team and that will be updated at some point um but again if you do want to see other Concepts uh for us to explore we love getting feedback in we want to make sure that these topics are relevant to you each week so please let us know in the survey and if you're interested in any of our possible lab academies we do record these and upload them to YouTube so make sure to check them out on the community site to subscribe to our community forum and uh you'll get notifications on the latest updates on future app academies okay and I think that's it okay so with all that being said thank you all for joining us today and we hope to see you again in two weeks at our next Academy thanks everyone

View original source

https://www.youtube.com/watch?v=Ag0r1uBqSI0