Open link in Agent App

kimberlylp
Giga Guru

When I click on an email link on my mobile device, it opens a web browser to login to Service Now. I have the Mobile Agent app installed on my device. How do I direct it to open in the app instead of the browser?

1 ACCEPTED SOLUTION

This works, but it's a little hokey.

The link in the email should just know it's being clicked from a mobile device. Every app I've ever used does this.

We will be forced to have two links in our emails one label "Mobile Link" with the deep link you've suggested and the browser link.

Our code looks like this:

  1. Create a notification email script, I named mine deeplink.
  2. I added the code to that email script:

var deepLinkGenerator = new global.MobileDeepLinkGenerator("agent");

var table = current.getTableName();

var link = '';

switch (table) {

    case 'incident':

        link = deepLinkGenerator.getFormScreenLink("sys_id_of_whatever_the_sys_id_is_for_that_applet_on_system_mobile", current.getTableName(), current.getValue("sys_id"));

        break;

    case 'incident_task':

        link = deepLinkGenerator.getFormScreenLink("sys_id_of_whatever_the_sys_id_is_for_that_applet_on_system_mobile ", current.getTableName(), current.getValue("sys_id"));

        break;

    case 'change_request':

        link = deepLinkGenerator.getFormScreenLink("sys_id_of_whatever_the_sys_id_is_for_that_applet_on_system_mobile ", current.getTableName(), current.getValue("sys_id"));

        break;

    case 'change_task':

        link = deepLinkGenerator.getFormScreenLink("sys_id_of_whatever_the_sys_id_is_for_that_applet_on_system_mobile ", current.getTableName(), current.getValue("sys_id"));

        break;

    case 'problem':

        link = deepLinkGenerator.getFormScreenLink("sys_id_of_whatever_the_sys_id_is_for_that_applet_on_system_mobile ", current.getTableName(), current.getValue("sys_id"));

        break;

    case 'problem_task':

        link = deepLinkGenerator.getFormScreenLink("sys_id_of_whatever_the_sys_id_is_for_that_applet_on_system_mobile ", current.getTableName(), current.getValue("sys_id"));

        break;

    default:

        link = deepLinkGenerator.getFormScreenLink("<sys_id>", current.getTableName(), current.getValue("sys_id")); //open's agent

        break;

}

template.print('<a href=' + link + '>Mobile Agent Link</a>');

  1. Add ${mail_script:deeplink} to whatever notifications are needed.

View solution in original post

11 REPLIES 11

Rama Jha2
Giga Contributor

I have similar requirement. Any luck you got some way to resolve this?

Hi Rama,

I am still having this issue. Looks like your interest has sparked my ask back to the top of the list. Thanks. I plan on trying Alex's suggestion. I'll let you know how it goes.

Alex Edmiston1
Giga Guru

You need to create a Deep link (see below) and then put it in your email notification. 

https://docs.servicenow.com/bundle/newyork-application-development/page/app-store/dev_portal/API_ref...

That will come as a notification for the agent app. I want if a outlook is configured in mobile device and users click on any link it should open in agent app. For now it is opening in mobile browser.