Now Mobile - Notification Redirection
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2024 11:05 AM
In our Now Mobile application, we are receiving approval notifications successfully, but when you click the notification you are not redirected to the approval record.
On the "Push Notification Message Content" table (sys_push_notif_msg_content), I am looking at the "Approval Record Assigned - RITM" record as it is the one sending the notification. It is completely out of the box with no changes in our instance.
(function buildJSON(/*GlideRecord*/ current, /*String*/ message, /*Object*/ attributes) {
var layoutFieldGenerator = new global.NotificationLayoutFieldGenerator();
var identifier = layoutFieldGenerator.layoutField(current.getTableName(), current.sys_id, "sysapproval");
var description = layoutFieldGenerator.layoutField(current.getTableName(), current.sys_id, "sysapproval.short_description");
var status = layoutFieldGenerator.layoutField(current.getTableName(), current.sys_id, "state");
var json = {};
json = {
"aps" : {
"sound" : "default"
},
"Redirection" : {
"Title" : gs.getMessage("Approval Requested"),
"To" : "Embedded",
"Destination": {
"DocumentId": "34ad6c5673332300c0b958c234f6a70d",
"ItemId": current.sys_id
},
"Context" : {
"ContextType": "RECORD",
"TableName": "sysapproval_approver",
"RecordId": current.sys_id
}
},
"Layout" : {
"Status": status,
"Identifier" : identifier,
"Description" : description
}
};
return json;
})(current, message, attributes);
Looking at System Log - Push Notifications, the DocumentID and ItemId, from the redirect section above, are the correct screen and the correct sys_id of the approval record.
So why is the notification not redirecting the user directly to the record? I don't see anything wrong in the logs.
Please mark this response as correct and/or helpful if it assisted you with your question.
Steven
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2024 11:50 AM - edited 03-08-2024 11:51 AM
Oddly enough I resolved this by commenting out the OOB "Redirection" section and adding the following:
var deepLinkGenerator = new global.MobileDeepLinkGenerator("Request");
// From this table [sys_sg_form_screen] copy the record screen sys_id in which you want to redirect and paste it.
var link = deepLinkGenerator.getFormScreenLink('34ad6c5673332300c0b958c234f6a70d', current.getTableName(), current.getValue("sys_id"));
"Link": link,
(function buildJSON(/*GlideRecord*/ current, /*String*/ message, /*Object*/ attributes) {
var layoutFieldGenerator = new global.NotificationLayoutFieldGenerator();
var identifier = layoutFieldGenerator.layoutField(current.getTableName(), current.sys_id, "sysapproval");
var description = layoutFieldGenerator.layoutField(current.getTableName(), current.sys_id, "sysapproval.short_description");
var status = layoutFieldGenerator.layoutField(current.getTableName(), current.sys_id, "state");
var json = {};
var deepLinkGenerator = new global.MobileDeepLinkGenerator("Request");
// From this table [sys_sg_form_screen] copy the record screen sys_id in which you want to redirect and paste it.
var link = deepLinkGenerator.getFormScreenLink('34ad6c5673332300c0b958c234f6a70d', current.getTableName(), current.getValue("sys_id"));
json = {
"aps" : {
"sound" : "default"
},
/*"Redirection" : {
"Title" : gs.getMessage("Approval Requested"),
"To" : "Embedded",
"Destination": {
"DocumentId": "34ad6c5673332300c0b958c234f6a70d",
"ItemId": current.sys_id
},
"Context" : {
"ContextType": "RECORD",
"TableName": "sysapproval_approver",
"RecordId": current.sys_id
}
},*/
"Link": link,
"Layout" : {
"Status": status,
"Identifier" : identifier,
"Description" : description
}
};
return json;
})(current, message, attributes);
Please mark this response as correct and/or helpful if it assisted you with your question.
Steven
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2025 03:20 PM
Hi Steven,
Just want to ask where you got the DocumentID?
In my Now Mobile push notification, I want to redirect the user to a specific problem record. Do you know which DocumentID should I be using?