Issue with Deep Links and Universal Links in Mobile App

bineetchaubey
ServiceNow Employee
ServiceNow Employee

Hi Team,

 

I’m encountering some issues with deep linking and universal linking in my mobile application and would appreciate any assistance.

 

Here’s a brief overview of the problem:

  1. When the app is installed on the mobile device:
    • The deep link works correctly.
    • The universal link, however, is not functioning as expected. It’s returning an error indicating that the Error Loading URL.
  2. When the app is not installed on the mobile device:
    • The universal link leads to a page showing the error: "Page not found. Sorry, the page you are looking for could not be found."

 

bineetchaubey_0-1722924229407.png

 

Details:

  • The deepLink generated works when the app is installed.
  • The uniLink does not seem to be valid, resulting in errors.
  • When the app is not installed, the universal link directs to a "Page not found" error in the browser.

 

 

What I’ve checked:

  • The deep link URL format appears correct and works as expected.
  • The universal link should theoretically resolve to the correct page, but it's either invalid or not properly set up.

Has anyone experienced similar issues or have any suggestions for troubleshooting or resolving this problem? Any advice on how to properly configure or debug the universal link would be greatly appreciated.

 

Following is script snippet for generating universal  link 

var screenSysId = '';
var screen = new GlideRecordSecure("sys_sg_form_screen");
screen.addQuery("name", "Workday Time Off Request");
screen.query();

if (screen.next()) {
    screenSysId = screen.sys_id.toString();
}

gs.info('screenSysId: ' + screenSysId);

var recordSysId = '1ef4c4201be30610096c21b0604bcbaa';
var tableName = 'x_snc_uni_inbox_universal_box_external_workday_approvals';

var deepLinkGen = new global.MobileDeepLinkGenerator('Request');
var deepLink = deepLinkGen.getFormScreenLink(screenSysId, tableName, recordSysId);
gs.info('deepLink: ' + deepLink);

var uniLink = deepLinkGen.getUniversalLink(deepLink);
gs.info('uniLink: ' + uniLink);

Thanks.

8 REPLIES 8

Hayo Lubbers
Kilo Sage

Hi @bineetchaubey ,

 

Resolving the problem, unfortunately not. But helping in troubleshooting, maybe...

 

If you add the following to the script, you get the decoded information from both the deepLink and the uniLink. Maybe you see something weird in the encoded link:

gs.info('deepLink: ' + deepLink);
var b64dl = deepLink.replace('https://dev201170.service-now.com/mobileapplink?snapp=mobile&params=','');
gs.info('deepLink : ' + GlideStringUtil.base64Decode(b64dl));
gs.info("redirectPayload deepLink : " + GlideStringUtil.base64Decode(JSON.parse(GlideStringUtil.base64Decode(b64dl)).redirectPayload));

var uniLink = deepLinkGen.getUniversalLink(deepLink);
gs.info('uniLink: ' + uniLink);

var b64uni = uniLink.replace('https://dev201170.service-now.com/mobileapplink?snapp=mobile&params=','');
gs.info("uniLink details : " + GlideStringUtil.base64Decode(b64uni));
gs.info("redirectPayload uniLink : " + GlideStringUtil.base64Decode(JSON.parse(GlideStringUtil.base64Decode(b64uni)).redirectPayload));

 

And (more advanced) you could go to the MobileDeepLinkGenerator Script Include and debug line by line what is happening by setting a breakpoint and verify in the Script Debugger.

Script Include : /nav_to.do?uri=sys_script_include.do?sys_id=d52318830ba03300dee1c71437673ac8

More info on the Script Debugger : https://docs.servicenow.com/bundle/xanadu-api-reference/page/script/debugging/task/launch-script-deb...

 

Hope this helps a bit,

Hayo

 

 

Hi @Hayo Lubbers  
After debugging I am getting the following outputs. All of these are same as the input values.
Is there a missing parameter in the input variable?

deepLink :   {
  "instanceId": "eadf36fcdb25978089535d00cf9619dd",
  "instanceName": "surfsedev",
  "instanceUrl": "https://surfsedev.service-now.com",
  "redirectPayload": "eyJTY3JlZW5JZCI6Ijk4MzMyMTA4MWI1MjAyMTBmODdjNTQ2NDYwNGJjYjE5IiwiUmVjb3JkSWQiOiJkZDI4NzQ2YzQ3NzI0MjEwMmVjYTMzZTc4MjZkNDMyMyIsIlRhYmxlTmFtZSI6Inhfc25jX3VuaV9pbmJveF91bml2ZXJzYWxfYm94X2V4dGVybmFsX3dvcmtkYXlfYXBwcm92YWxzIn0=",
  "action": "redirect"
}

redirectPayload deepLink  :
{
  "ScreenId": "983321081b520210f87c5464604bcb19",
  "RecordId": "dd28746c477242102eca33e7826d4323",
  "TableName": "x_snc_uni_inbox_universal_box_external_workday_approvals"
}

universal link deatils :  {
  "instanceId": "eadf36fcdb25978089535d00cf9619dd",
  "instanceName": "surfsedev",
  "instanceUrl": "https://surfsedev.service-now.com",
  "redirectPayload": "eyJTY3JlZW5JZCI6Ijk4MzMyMTA4MWI1MjAyMTBmODdjNTQ2NDYwNGJjYjE5IiwiUmVjb3JkSWQiOiJkZDI4NzQ2YzQ3NzI0MjEwMmVjYTMzZTc4MjZkNDMyMyIsIlRhYmxlTmFtZSI6Inhfc25jX3VuaV9pbmJveF91bml2ZXJzYWxfYm94X2V4dGVybmFsX3dvcmtkYXlfYXBwcm92YWxzIn0=",
  "action": "ulink",
  "url": "https://surfsedev.service-now.com/mobileapplink?snapp=mobile&params=eyJpbnN0YW5jZUlkIjoiZWFkZjM2ZmNkYjI1OTc4MDg5NTM1ZDAwY2Y5NjE5ZGQiLCJpbnN0YW5jZU5hbWUiOiJzdXJmc2VkZXYiLCJpbnN0YW5jZVVybCI6Imh0dHBzOi8vc3VyZnNlZGV2LnNlcnZpY2Utbm93LmNvbSIsInJlZGlyZWN0UGF5bG9hZCI6ImV5SlRZM0psWlc1SlpDSTZJams0TXpNeU1UQTRNV0kxTWpBeU1UQm1PRGRqTlRRMk5EWXdOR0pqWWpFNUlpd2lVbVZqYjNKa1NXUWlPaUprWkRJNE56UTJZelEzTnpJME1qRXdNbVZqWVRNelpUYzRNalprTkRNeU15SXNJbFJoWW14bFRtRnRaU0k2SW5oZmMyNWpYM1Z1YVY5cGJtSnZlRjkxYm1sMlpYSnpZV3hmWW05NFgyVjRkR1Z5Ym1Gc1gzZHZjbXRrWVhsZllYQndjbTkyWVd4ekluMD0iLCJhY3Rpb24iOiJyZWRpcmVjdCJ9"
}

universal link redirectPayload details :
 {
  "ScreenId": "983321081b520210f87c5464604bcb19",
  "RecordId": "dd28746c477242102eca33e7826d4323",
  "TableName": "x_snc_uni_inbox_universal_box_external_workday_approvals"
}


 

Hi @bineetchaubey ,

 

Maybe a stupid suggestion, but did you enable universal linking? Apparently it is off by default...

"By default the mobile universal linking option is not available in the base system."

https://docs.servicenow.com/bundle/xanadu-mobile/page/administer/tablet-mobile-ui/task/universal-lin...

 

If all is active and the details in the links seem to be fine, please check with the mobile development team.

bineetchaubey
ServiceNow Employee
ServiceNow Employee

Hi @Hayo Lubbers 

Yes, it is enabled.