Send Push Notifications using Events | Mobile App
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
2. Navigate to . Click New.
3. Fill the form and save it. Now Click on "Create Push Message Content" under Related links.
4. Navigate to . [Important]
Change View to Advance
When to send
Who will receive
What it will contain
Update the Notification.
5. Navigate to
SCRIPT
(function executeRule(current, previous /*null when async*/) {
// Add your code here
gs.eventQueue("incident.created", current, gs.getUserID(), '');
})(current, previous);
https://www.servicenow.com/community/mobile-apps-platform-articles/send-push-notifications-using-events-mobile-app/ta-p/2302583