Dynamic URL change from Mobile to Desktop
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Tuesday
Hi All,
Is it possible to change the URL view dynamically when a user changes from Mobile to Desktop
Basically, when user open one of the notification email redirection URL from Mobile user is navigated to this URL in mobile "https://myinstancename.service-now.com/$m.do#/home" So when user copy pasted same URL in desktop mobile friendly view remains. We would like to change the URL dynamically when we switch from Mobile to Desktop. is it possible?
I'm Aware of the option to change URL manually to /?sysparm_device=doctype and switch to desktop option from Profile
But We are looking for dynamic option.
Thank you in advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Tuesday
Hi @SM123 ,
ServiceNow provides an OOB API called MobileDeepLinkGenerator that can be used to create dynamic links that adjust based on the user's device....
>> Steps: Create a Script Include....
Define a Script Include that utilizes the MobileDeepLinkGenerator API to construct the URL dynamically.
Generate the Link:
Use the Script Include to generate a link that will open in the appropriate interface based on the user's device.
Example:
var LinktoOpen = Class.create();
LinktoOpen.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getLink: function() {
var link = new MobileDeepLinkGenerator();
return link.getLink('incident', this.getParameter('sys_id'));
}
});
This Script Include generates a link to an incident record that will open in the mobile app if accessed from a mobile device, or in the desktop interface if accessed from a desktop....
If you found my response helpful, please mark it as āAccept as Solutionā and āHelpfulā. This helps other community members find the right answer more easily and supports the community.
Kaushal Kumar Jha - ServiceNow Consultant - Lets connect on Linkedin: https://www.linkedin.com/in/kaushalkrjha/