- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
‎11-30-2022 04:09 AM - edited ‎11-30-2022 04:12 AM
This article will help to setup the push notifications for Agent App.
Follow below steps.
1. Create applet on the mobile studio under ITSM Mobile Agent or your scoped application.
After creation of applet get the sysid of applet go the sys_sg_screen table list or click System Mobile> Screens module and filter name with Applet name+ Record Screen.
2. Go the Record Screen of your applet and copy sys_id and will provide this sys_id on Push Message Content script on DocumentId variable.
3. Create Push message content go to the system Notification> Push> Push Message Content.
4. On new form give name and select ServiceNow Mobile Application on Push app field.
use below script and replace applet record screen sysid on DocumentId.
(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 state = layoutFieldGenerator.layoutField(current.sys_class_name, current.sys_id, "state");
var json = {};
json = {
"aps": {
"sound": "default"
},
"Redirection": {
"Title": gs.getMessage("New Incident ASssigned"),
"To": "Embedded",
"Destination": {
"DocumentId": "8f5f07a89757111051cb341e6253af2c", //need to give the applet form screen sysid
"ItemId": current.sys_id
},
"Context": {
"ContextType": "RECORD",
"TableName": current.sys_class_name,
"RecordId": current.sys_id
}
},
"Layout": {
"Status": state,
"Identifier": identifier,
"Description": description
}
};
return json;
})(current, message, attributes);
5. Go to system Notification> Push> Push Messages and Create the Push Message.
Select the Push app and Table and Push content which created above.
Give the Message as per your need and use ${fieldname} to get the value.
6. After Creation of Push message then create notification on the same table and give the conditions on When to Send tab and provide users on who will receive tab and What to send add Push Message which created before.
Note: you can Set notification view as Push Notification View.
Refer below screen
7. Now go the System Notification > Push > Push Application and open the ServiceNow Mobile Application
8. Under related Push Default Registrations and click new and select add notification which created on step 6.
Refer below
9. Output
- 2,676 Views
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
@Pavankumar_1, any tips for troubleshooting? I am trying to get this to work for Catalog Tasks (sc_task) but have not been able to generate any push notification. We have other working notifications that our implementers set us up with that I have checked against, but can't find where my problem is.
Everything is set up in the ITSM Mobile Agent application scope.
I have the correct sys_id from
I have tried using existing notifications and creating new ones. I have also tried the default Push Message Content from SN's docs.
(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 deepLinkGenerator = new global.MobileDeepLinkGenerator("Agent");
var link = deepLinkGenerator.getFormScreenLink('ef58125cb7033300295a9489de11a988', current.getTableName(), current.getValue("sys_id"));
json = {
"aps" : {
"sound" : "default"
},
"Link": link,
"Layout" : {
"Status": status,
"Identifier" : identifier,
"Description" : description
}
};
return json;
})(current, message, attributes);
Any thoughts?
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
This is really helpful.
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
@Pavankumar_1 Is this still valid? I no longer see a concept of applet while configuring a mobile app, can you please guide me the table name?
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
@Satheesh12 - I checked my notes and this is the table I had listed for my applet record screen:
sys_sg_form_screen
I hope this helps,
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
how to open notification tab/screen [open sys_sg_notifications_tab] from icon section? is it possible to open it from icon ?