Best way to extract a sys_id from a URL on a map page?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2022 06:55 AM
I have a UI action which redirects to a map page to display a location's coordinates.
I wish to display the coordinates of the particular location from a UI Action on it's form view.
I can pass the locations sys_id in the redirected URL but wish to extract that to use it but the bellow code is not working.
// redirect to map page with sys_id
gs.setRedirect("map_page.do?sysparm_sys_id=b0395f572fe341101aa7ff1df699b645&sysparm_location=" + current.sys_id);
- - - - - - -
//Display map with coordinates
var myparm = gs.action.getGlideURI().getMap().get("sysparm_location");
gs.info("sys_id1= " + myparm);
//Grab this incident record from the sys_id
var gr = new GlideRecord("locations");
gr.addQuery('sys_id', myparm);
gr.addActiveQuery();
gr.query();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2022 07:04 AM
Assuming :
In the myparm you are not getting the sys_id of the incident . Make sure to get the incident sys_id.
Check that once.
Mark correct and helpful, if it helps
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-08-2022 10:12 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-09-2022 04:17 AM
For anyone interested, the solution was to set the sys_id to a session variable and to get it from the Map Page as follows.
UI Action
var session = gs.getSession();
session.putClientData('sys_id', current.sys_id);
Map Page
var session = gs.getSession();
var myparm = session.getClientData('sys_id');