Push Notifications Not Working in Mobile App Builder
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
5 hours ago
Hi Team,
I am trying to set up push notifications for my Mobile App Builder application, but they are not working. I am also unable to find any push notification logs in the sys_push_notification table (Push Logs).
I have completed the following configuration:
- Created a new Push Message.
- Configured the Push Notification Message Content.
- Created a new Notification with Push Message Only = True.
- Linked the Push Message field in the Notification to the Push Message created in Step 1.
- Enabled notifications in the Now Mobile app.
- Added the Push Application (ServiceNow Mobile Application) to the Mobile App Builder.
- Verified the cmn_notif_device record for the user and confirmed that Push is enabled for Now Mobile/Agent.
- Used the following message content:
(function buildJSON( /*GlideRecord*/ current, /*String*/ message, /*Object*/ attributes) {
var layoutFieldGenerator = new global.NotificationLayoutFieldGenerator();
var identifier = layoutFieldGenerator.layoutField(current.sys_class_name, current.sys_id, "number");
var description = layoutFieldGenerator.layoutField(current.sys_class_name, current.sys_id, "short_description");
var status = layoutFieldGenerator.layoutField(current.sys_class_name, current.sys_id, "priority");
var json = {};
var layoutFieldGenerator = new global.NotificationLayoutFieldGenerator();
var identifier = layoutFieldGenerator.layoutField(current.sys_class_name, current.sys_id, "number");
var description = layoutFieldGenerator.layoutField(current.sys_class_name, current.sys_id, "short_description");
var state = layoutFieldGenerator.layoutField(current.sys_class_name, current.sys_id, "state");
//set clientType to Agent for ServiceNow Agent, Request for Now Mobile
var clientType = "Agent";
//Set ScreenId to the sys_id of the record screen a tap from the notification
var screenId = "4ff395893bfd03504a7d8c9aa4e45a5a
"; //replaced with the embedded screen sys_id
"; //replaced with the embedded screen sys_id
var deepLinkGenerator = new global.MobileDeepLinkGenerator(clientType);
var link = deepLinkGenerator.getFormScreenLink(screenId, current.getTableName(), current.getValue('sys_id'));
var json = {
"aps": {
"sound": "default"
},
"Link": link,
"Layout": {
"Status": state,
"Identifier": identifier
}
};
return json;
})(current, message, attributes);
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
5 hours ago