Links to knowledge articles in the now mobile app

nifiru
Tera Contributor

Hello,

we have configured and deployed the now mobile app for our company. One important use of the now mobile app is to access our knowledge bases. 

In our knowledge articles, we often link to other knowledge articles. To get these links, we used the "copy permalink" feature. These links are containing the corossponding Service Portal (https://instance.service-now.com/portal?id=kb_article_view&sysparm_article=KB-Number). Now, when a KB article link is clicked in the app, the corresponding ServicePortal is also accessed. Unfortunately, this view is not very appealing compared to the "native" mobile view. 

How do you deal with that issue? Is there any way to redirect to mobile view when the link is clicked on mobile for example? Do we need to adjust all our links in kb-articles to a more generic one? 

6 REPLIES 6

Varshith Kuraga
Tera Guru

I am working on the same implementation and wanted to check if you achieved it 

Hello, sorry for the late reply. We still have not been able to reach it. Have you?

Rajdeep Ganguly
Mega Guru
Yes, you can handle this issue by creating a script to detect the user's device and redirect to the appropriate view. Here's a high-level overview of how you can achieve this: 1. Create a UI Script: This script will check if the user is on a mobile device or not. You can use the navigator.userAgent property in JavaScript to detect the device type. 2. Create a UI Page: This page will contain the logic to redirect the user to the appropriate view (Service Portal or Native Mobile) based on the device type detected in the UI Script. 3. Update KB Article Links: You will need to update the links in your KB articles to point to the new UI Page you created. This page will then handle the redirection to the appropriate view. Here's a sample code for the UI Script: javascript function isMobileDevice() { var userAgent = navigator.userAgent || navigator.vendor || window.opera; if (/windows phone/i.test(userAgent)) { return true; } if (/android/i.test(userAgent)) { return true; } if ((/iPad|iPhone|iPod/.test(userAgent) && !window.MSStream)) { return true; } return false; } And here's a sample code for the UI Page: xml isMobileDevice(); Please note that this is a high-level solution and might need adjustments based on your specific requirements and ServiceNow instance configuration.

Hey Rajeed, thanks for this solution. That looks very promising. I'll have a look at it.

We wanted to avoid modifying all the links in the KB articles as we have a lot of them. Can you think of a solution without changing all the links?