The CreatorCon Call for Content is officially open! Get started here.

Is it possible to read URL of a map page in ServiceNow?

ramireddy
Mega Guru

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?

6 REPLIES 6

syedfarhan
Kilo Sage

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


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


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


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?