How to create a Push notification for "Assigned to my group"?

John Fallara
Giga Contributor

I'm trying to create a push notification for the Now Mobile app when an incident is assigned to one of my groups. I used this article as a walk-through and was able to get the push notifications sending when I expect them to, and with the correct information in the notification itself.

The issue is that when I then tap the notification on the phone, instead of opening the incident, it takes me to the list level above the incident with an error on the bottom of the screen that reads "This record is not available." The incident record does actually exist though. I can open it manually in the app.

I used the Javascript from the out of the box "Incident assigned to me" push notification and have tried updating the Document ID to various values and I just can't find one that will open the Incident details. I don't understand why pointing it to Incidents screen under the Incidents folder in the Incidents applet (where the "Incident assigned to me" notification points, by default) doesn't work for an incident assigned to my group.

(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 = {};
    
    json = {
        "aps" : {
            "sound" : "default"
        },
        "Redirection" : {
            "Title" : "Incident assigned to my group",
            "To" : "Embedded",
            "Destination": {
                "DocumentId": "7323ae8567f82300b270c3105685ef9e",
                "ItemId": current.sys_id
            }
        },
        "Layout" : {
            "Status": status,
            "Identifier" : identifier,
            "Description" : description
        }
    };
    
    return json;
    
})(current, message, attributes);
1 REPLY 1

RubenFuertes
Tera Guru

Hi Jhon,

I have also gone crazy with this. You can find the explanation in the follow article from Hi. If "Group email" field is filled the notification push will not be sent.

https://hi.service-now.com/kb_view.do?sysparm_article=KB0743654