logo

NJP

Send Push Notifications using Events | Mobile App

Import · Sep 08, 2020 · article

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 . Click New.

image

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

image

4. Navigate to . [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

image

SCRIPT

(function executeRule(current, previous /*null when async*/) {

    // Add your code here
    gs.eventQueue("incident.created", current, gs.getUserID(), '');

})(current, previous);
View original source

https://www.servicenow.com/community/mobile-apps-platform-articles/send-push-notifications-using-events-mobile-app/ta-p/2302583