Agent App deeplink to Record screen

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2024 03:56 AM - edited 03-11-2024 03:57 AM
Hi all,
For a Push notification setup in the Agent App, I want to set up a deeplink to the specific record the Push notification is about. The Push notification etc works fine, only thing is somehow the deeplink does not work 😅. I'm still investigating, and going to watch a Mobile App Academy now, though perhaps someone already has an idea.
This is the Push Notification Message Content record, where I am using function .getFormScreenLink and the sys_id is the sys_id of a valid Record screen.
(function buildJSON(/*GlideRecord*/ current, /*String*/ message, /*Object*/ attributes) {
var layoutFieldGenerator = new global.NotificationLayoutFieldGenerator();
var status = layoutFieldGenerator.layoutField(current.sys_class_name, current.sys_id, "status");
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 json = {};
var deepLinkGenerator = new global.MobileDeepLinkGenerator("Agent");
var link = deepLinkGenerator.getFormScreenLink('dca9a6e487b0c21089b465babbbb3525', current.getTableName(), current.getValue("sys_id"));
json = {
"aps" : {
"sound" : "default"
},
"Link": link,
"Layout" : {
"Status": status,
"Identifier" : identifier,
"Description" : description
}
};
return new sn_itsm_mobile_agt.CriticalPushPayloadBuilder(current, json, attributes).buildJSON();
})(current, message, attributes);
Perhaps I just made a coding error? Or is there more involved for the deeplink, than just setting up the Push Notification Message Content record?
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2024 10:38 AM
What error are you seeing when you click on the push notification, is it "Error Loading URL"?
I get the same error using the message content you provided, but switching to a basic template (below, taken from this Doc ), it seems to work. So I'd guess the issue is either in the "CriticalPushPayloadBuilder" or "NotificationLayoutFieldGenerator" script includes?
Both log errors when adding a try/catch, I'll try to dig further into the errors later.
Hope this helps for now?
Thanks,
Jason
(function buildJSON(/*GlideRecord*/ current, /*String*/ message, /*Object*/ attributes) {
var deepLinkGenerator = new global.MobileDeepLinkGenerator("Agent");
var link = deepLinkGenerator.getFormScreenLink([**SYS_ID**], current.getTableName(),current.getValue("sys_id"));
var json = {};
json = {
"Link": link
};
return json;
})(current, message, attributes);