Get paramter sysparm_query from URL using jelly
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-20-2016 11:08 AM
I want to get the sysparm_query value from this url: nav_to.do?uri=/ui_page.do%3Fsys_id%3D222a312fdbb9220065dfd001cf96191e%26sysparm_query%3Dstate%253D1
by using jelly. I used:
<j:set var="jvar_query" value="${sysparm_query}" />
and
<j:set var="jvar_query" value="${RP.getParameterValue('sysparm_query')}" />
In both cases I can't get the value.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-20-2016 06:40 PM
Can you provide some additional context. Where is this Jelly code being run? UI Macro? UI Page? If Macro, where is it being instantiated? What is a sample URL you are using?
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-21-2016 02:34 AM
I have created a context menu:
/**
* Script executed on the Client for this menu action
*
* The following variables are available to the script:
* 'g_list' the GlideList2 that the script is running against (only valid for List context menus)
* 'g_fieldName' the name of the field that the context menu is running against (only valid for List context menus)
* 'g_sysId' the sys_id of the row or form that the script is running against
* 'rowSysId' is also set to the sys_id of the row to support legacy actions, but g_sysId is preferred
*/
runContextAction();
function runContextAction() {
var url = new GlideURL('ui_page.do?sys_id=222a312fdbb9220065dfd001cf96191e');
//url.addParam('sysparm_table', g_list.getTableName());
url.addParam('sysparm_query', g_list.getQuery({orderby: true, fixed: true}));
window.location = url.getURL();
}
From the context menu I want to open an ui page with the query which i want to use for further prossesing.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-21-2016 03:48 AM
Take this one line
window.location = url.getURL();
and debug the URL this way to validate you are getting a valid URL...
var s = url.getURL();
gs.log('>>>DEBUG: s=' + s);
window.location = s;
What do you see in the log output? (System Logs> Logs> Script Log Statements)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-21-2016 08:42 AM
This is what I get:
DEBUG: s=ui_page.do?sys_id=222a312fdbb9220065dfd001cf96191e&sysparm_query=state%3D1

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-21-2016 08:44 AM
Excellent. Thanks!
Does that information show up anywhere in the debug output when you hit your g:breakpoint?