- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-12-2019 12:02 PM
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?
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-18-2020 06:45 AM
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:
- Create a notification email script, I named mine deeplink.
- 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>');
- Add ${mail_script:deeplink} to whatever notifications are needed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-18-2020 04:29 AM
Thanks for you time Alex. I will try this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-18-2020 06:45 AM
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:
- Create a notification email script, I named mine deeplink.
- 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>');
- Add ${mail_script:deeplink} to whatever notifications are needed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-02-2020 11:18 PM
On similar note is there a possibility to check if the app is not found in mobile it will redirect to app store?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-26-2022 11:45 AM
I could use some help doing this in Rome. I can't get an additional link to come though as described.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-31-2022 03:28 PM
template.print('<a href=' + link + '>Mobile Agent Link</a>');
This link still prompts a browser instead of the app.