Create Push notification as web path in NowMobile app

Sebastian L
Mega Sage

Hi guys,

In the NOW Mobile, I am trying to create a push notification, that will take me to the /mesp portal and display a ticket, e.g. an incident. 

With a formscreen it is easy, and you do the deepLinkGenerator.getFormScreenLink. No problems, but if I want a custom url I can't get it to work. In the Classic app it supported "web_path", and it could be configured something like this: 

var json = {};
	
json = {
"aps" : {
			"sound" : "default"
		},
		"web_path" : "/mesp?id=mobile_ticket&table="+current.getTableName()+"&sys_id="+current.getValue("sys_id")
	};
	
	return json;

But I can't get that to work in the NowMobile. Honestly the documentation on the properties in the JSON object is... lacking. And you can link to screens in different ways, by using the property "Redirection" (using documentId as formscreen) or "Link" (Having the link generator).

Do any of you know a way to configure the push notification to redirect the user to a portal page, instead of a form screen? Just as it is possible in the app clicking on a list item, and then have a function instance to redirect the user? 

 


Best regards,
Sebastian Laursen
1 ACCEPTED SOLUTION

Webpath is not supported in NOW Mobile.

In Rome there will come an option to do the same as webpath in the NOW Mobile.

 

So to do this now, you need to be on the Quebec version and you can use the  deepLinkGenerator.getFormScreenLink. Make sure the sys_id in the parameter is a browser screen and it will auto translate e.g. {{sys_id}} from the push notification.

 

This does NOT work on the Paris release, where it can't translate the {{sys_id}} for some reason. I've tested this out on several instances, and also with the same records. When upgrading to Quebec this works, but on a Paris instance it can't get the value. Configuration of push notification message content. You can replace the "Agent" with "request" if you wish to have the NOW Mobile.

(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('9f045535532033002d96ddeeff7b127b', current.getTableName(), current.getValue("sys_id")); 
	var link = deepLinkGenerator.getFormScreenLink('5d035caf2f3320103eb45e492799b6f3', current.getTableName(), current.getValue("sys_id")); 
    json = {
        "aps" : {
            "sound" : "default"
        },
        "Link": link,
        "Layout" : {
            "Status": status,
            "Identifier" : identifier,
            "Description" : description
        }
    };
    
    return json;
    
})(current, message, attributes);

Best regards,
Sebastian Laursen

View solution in original post

14 REPLIES 14

No, what I did in Paris was to create an applet that takes a sys_id as an argument (so a list applet), and then link to that.. On the applet is then a list-function, that takes you to the portal.

 

So the user would have to click twice, once on the notification and then once on the filtered list on the item. 


Best regards,
Sebastian Laursen

Thanks for that. How do you configure the list function to go to the portal?

What I am really struggiling with is passing the sys_id to the URL. I have tried with and without {{sys_id}} but neither seem to work.

Thank you! it's really work

Aditi22
Tera Contributor

I have followed all your steps and created push notifications and browser screen.

But the browser screen is not accepting the sys_id dynamically. My instance is on Quebec Version 

While opening the push notification in mobile I am getting an error.

find_real_file.png

Could you please help me on the steps you followed for browse screen.