Send Push Notifications using Events | Servicenow Mobile

Push Notification

A push notification is a concise text message that appears on a user’s mobile device to alert them about something important or to ask them to perform an action.

Servicenow docs provide the step by step process of creating push notifications but it doesn’t explain the process of triggering notification via Events. As we know, events add the flexibility to perform the action from any server-side code. 

Pre-requisites

Now Mobile Application – Must be installed

ITSM Mobile [com.sn_item_mobile] Plugin – Must be installed for testing purposes.

Navigation in native view – Good to have 

Knowledge of Notifications – Good to have

Story

Create and trigger push notification when an incident is created by Mobile App. Push Notification should show the message line as “An incident has been created for you.”

Solution

1. Register Event [If doesn’t already] by navigating to System policy > Events > Registry. Click New

image

2. Navigate to System Mobile > Mobile Push Notifications > Push Notifications. Click New.

image

3. Fill the form and save it. Now Click on “Create Push Message Content” under Related links.

image

4. Navigate to System Notification > Push > Create Push Notification. [Important]

image

Change View to Advance

image

When to send

image

Who will receive

image

What it will contain

image
image

Update the Notification. 

5. Navigate to System Notification > Push Application. Find and Open the target application. If you are following the above screenshots as is then you must select Servicenow Request Application. 

Add the Related List Push Default Registrations > Push App [it doesn’t already exisit]. Click New

image

6. The final step is to Create After Insert Business rule to trigger a push notification. 

image

SCRIPT

(function executeRule(current, previous /*null when async*/) {
	// Add your code here
	gs.eventQueue("incident.created", current, gs.getUserID(), '');
})(current, previous);

We are done with configuration. Please make sure to re-login into Now Mobile app and then create incident. Refresh the screen and you will receive a push notification saying “An incident has been created for you.”

Please note, Make sure to test this by creating an incident via the correct mobile application, not platform.

Voila!!

Leave a Comment

Your email address will not be published.