Is it possible to read URL of a map page in ServiceNow?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-07-2016 01:56 AM
Hi Guys,
I am trying to find URL of a map page in Service Now. Once I get the URL, I will parse it to read the parameter that passed to that map page. I tried various syntax in Map page script. But none seems to work. I am not sure whether the script of the map page is a client script or server script either
Can any one tell me, how can get URL of a map page in it's script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-07-2016 02:08 AM
Hi Ram,
You can try this. but i'm pretty not sure of this
/Create and display the Map URL
var mapURL = "http://maps.google.com/?q=";
//Try location and city
if(gr.street && gr.city){
mapURL = mapURL + gr.street + ',' + gr.city + ',' + gr.state + ',' + gr.zip + ',' + gr.country;
}
//Else try latitude and longitude
else if(gr.latitude && gr.longitude){
mapURL = mapURL + gr.latitude + ',' + gr.longitude;
}
//Strip '#' symbols to avoid encoding errors
mapURL = mapURL.replace(/#/g, "");
window.open(mapURL);
}
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-07-2016 02:39 AM
Hi Farhan,
I am not using Google maps. I am using in-built service-now maps. From a UI page, I am calling this Map page with the following URL.
document.location = "map_page.do?sysparm_name=MobileDeviceLocation&id=f90e06af0a0a0b9100a6defd15c548e9";
I want to read this URL back in Map page script. But it's throwing the following error.
org.mozilla.javascript.EcmaError: "document" is not defined.
Caused by error in Map Page: 'MobileDeviceLocation' at line -1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-07-2016 03:04 AM
Hi ram,
document.location = "$map_page_primary.do?sysparm_name=Mobile%20DeviceLocation&id=f90e06af0a0a0b9100a6defd15c548e9";
Note: If the map page title has a space in it, replace the space with %20 for the correct syntax. For example, a map page called Critical Incidents becomes Critical%20Incidents%20 in a URL.
https://Instancename.service-now.com/$map_page_primary.do?sysparm_name=Critical%20incidents
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-07-2016 03:11 AM
Hi Farhan,
Map page name doesn't have a space in it. However, map page is appearing with no issues. Only issue is, I am not able to read additional parameter passed to map page.
So, I am looking for a way to read parameter value or entire URL of the map page itself?