dynamic service portal widget filter using URL parameters

jamesmcwhinney
Giga Guru

I am trying to get a page to render a series of "simple list" widgets and filter them dynamically using parameters passed by the URL.


I cant use "Data Table from URL definition" because I need to display and filter against two different tables.

Is there any way to just populate the filter field of the widget instance dynamically using variables from the URL?

 

Thanks,

- James

4 REPLIES 4

Gaurav Bajaj
Kilo Sage

Hi,

What you can do here is get the current URL in widget server script and parse it to fetch the filter parameter.

Once you have it, you can use the filter in encoded query and then data will be reflected based on the URL parameter.

 

gs.action.getGlideURI(); gives you the current url on stack.

 

PS: all this can be achieved in the cloned widget and replace the OOB widget for the simple list with your custom widget.

 

find_real_file.png

 

Please mark it correct/helpful based on the response.

Thanks

Gaurav

Thanks Gaurav,

 

I was hoping there would be a way to do this without cloning the widget.

Is there no way I can just specify the filter in the widget instance?

something like "opened_byDYNAMICjavascript:getUrlParam('opened_by')"

 

 

 

 

I doubt that you can get it this way as the filter fields from options is just a plain text field and the way it has been used in the widget is not gonna help you either. so changing the widget seems like a better option here.

 

Thanks

Gaurav

@Gaurav Bajaj I do not see how data.urlFilter will help in this case. Suppose I had two different tables and click the link in a simple list to get to another page with more simple lists. If the simple lists are on a different table, how do they filter correctly? 

Is there a way to get just the sys_id part of the url out and into the filter somehow?