Ui Action on List - Get Filter as EncodedQueryString

Tuna
Giga Guru

Hi All,

There is a list with users Expense Lines. User is able to filter the list and by pressing the UI Action an export list (csv) should be generated via processor. Because some attributes necessary for the export are collected from a configuration table. Therefore I am trying to get the filtered lists encodedQueryString but I am failing. I tried it with g_list on client side but I am getting it is not defnied. GlideList2 is also not definied. The list has fixed query parameters and I also wanted to keep the order and stuff, like it is defnied in g_list.getQuery() API. Why is this global variable not definied on client? Also I do not want the user to have to select the relevant records, therefore the name of the UI Action starts with sysverb_.

Any ideas?

BR

1 ACCEPTED SOLUTION

Tuna
Giga Guru

Ok, I found this solution:

UI Action is Server Side Script. URI contains query already as encodedQueryString. All you have to do is extract it from there. Following code shows how it works and it is by far easier as expected:

var uri = gs.action.getGlideURI(); // gives object from type GlideURI()
var quer = uri.get('sysparm_fixed_query'); // extracts fixed encoded query string
var quer2 = uri.get('sysparm_query'); // extracts users query string
gs.addInfoMessage(quer);
gs.addInfoMessage(quer2);

You are welcome!

View solution in original post

2 REPLIES 2

Tuna
Giga Guru

Ok, I found this solution:

UI Action is Server Side Script. URI contains query already as encodedQueryString. All you have to do is extract it from there. Following code shows how it works and it is by far easier as expected:

var uri = gs.action.getGlideURI(); // gives object from type GlideURI()
var quer = uri.get('sysparm_fixed_query'); // extracts fixed encoded query string
var quer2 = uri.get('sysparm_query'); // extracts users query string
gs.addInfoMessage(quer);
gs.addInfoMessage(quer2);

You are welcome!

Nestor Paredes
Tera Contributor

There is a list contextual UI Action called "Delete all with preview"

NestorParedes_0-1714736197562.png

 

 

That then opens this:

NestorParedes_1-1714736253655.png

 

Regards,

N.