top of page

Push Actions from Push Notifications, did you know that ?

Atualizado: 21 de mar. de 2022

This needs just came up to me few weeks ago and to be honest i didn't know about it at all. Push notifications and a lot of features around Now Mobile, ok! But actions from push notifications even without open the Now Mobile app.. No! It was totally new.

The idea is to our push notifications become actionable and one example of action is: Resolve an Incident.


In a push notification (there's OOB) for incidents created we'll add 2 actions: 'Resolve Incident' and 'Add a comment'. First action will set state to Resolved, set the Resolution Code as 'Closed/Resolved by Caller' and the user input will be added as a Resolution Notes. Second action will just add a comment to the incident.

Push Actions

Basically Push Actions allows the user to perform few actions to their tasks as needed (there are limitations) from a push notification received without even open the app (if we want this behavior).

A big picture of how it works:

So, we need to follow the same idea when creating push notifications, we need a notification with a flag push message only as a true and assign a push message with a push message content to it and it's fine.

Let's get started:

- We need to create a Push Notification [sys_sg_push_notification] (I know ServiceNow isn't the most creative by giving names) with Actionable field as a true. The Screen field it's not mandatory, we can just define a screen (in other words: applets) to be redirected when you trigger a push action, but in my case i defined this field dynamically using the script include which builds the message content: ActionablePushPayloadBuilder.

- Now we need to create a push action category, if what we have OOB it's not enough, here you define a group of action(s) in a category to be used later on push notifications.

- Each Push Action Category has push actions associated, if the OOB it's not enough for you, create them! In Push Action's form we have important points to take a look: Response Type and Foreground field:

- Response type might be Text Response or Simple, in my case Text Response is the best option because the value inserted by the user will be used as a UI parameter.

- Foreground as a true define that you will be redirected to the app after trigger the action (and the destination is defined by script or in push notification's form as i already mentioned), if false, the action is perfomed in the background without open Now Mobile app.

- Are you still there? So, now we need to create Push Action Instances, here we associated our push notification, push action and what wasn't mentioned until now is the button, in other words: Functions, which will actually perform an action like update a field or insert a comment for example. For each actio nyou need to perform we need a push action instance. So here i've created 2 push action instances because i need to enable the user to Resolve an incident or Add a comment.

Now we have almost everything, we just need to create our notification [sysevent_email_action] (Push Message only as true) and the set a Push Message with a Push Message Content, i know it might be confusing, but see the next following images to better understanding:

As we can see in the picture above, one different thing from the usual when using push message content is, to enable push actions we can't build the json inside the push message content, we have to use the script include ActionablePushPayLoadBuilder with few parameters: Current record (Incident in my case), Sys id of the push notification created, JSON with few parameters (you can change according your needs).

HINT -> In Push Notification's form there's a ui action 'Creat Push Message Content' which creates a new push message content record with the scrip pre-filled as we can see below:

The way we can trigger might different if you use iOS or Android, using iOS you have to press for few seconds and the actions will pop up below and in Android the actions available pop up with the push notification automatically. In my case, i have an iPhone so i see:

And it's done! I hope this article can help you in your implementations. That's my frist article so take it easy with me HAHA.

Feel free to give your feedback!


77 visualizações0 comentário
bottom of page