Get paramter sysparm_query from URL using jelly

sergej11221
Mega Contributor

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.

14 REPLIES 14

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.


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.


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)


This is what I get:



DEBUG: s=ui_page.do?sys_id=222a312fdbb9220065dfd001cf96191e&sysparm_query=state%3D1


Excellent. Thanks!



Does that information show up anywhere in the debug output when you hit your g:breakpoint?