The CreatorCon Call for Content is officially open! Get started here.

Using Variables in Service Portal Widget Filter

adambraden
Kilo Explorer

I'm still green in Service Portal widget development, so I'm needing some help.

First off, I have a scoped application where I cloned the Data Table widget.   Within the cloned data table widget, I was able to able to use the server.get method to push the URL Parameters over to the server script so I can access those parameters as input parameters.   This was done for reusability since my parameters may change depending on the widget instance/page.

So, something like this:

Client Script:

c.server.get({

urlParams: $location.search()

});

Server Script:

if (input.urlParams) {

data.urlParams = input.urlParams;

}

Now, I can access my parameters within the server script, but what I'm trying to figure out now is how to utilize those parameters within the filter field which is a string field.   Basically, I want to be able to access the widget options and do something like "object=data.urlParams.object" in the filter field and have the server script recognize that there is a variable in the string in some way.

I feel like I'm missing something simple, so hopefully somebody has done this or may have a workaround.

3 REPLIES 3

Nate23
Mega Guru

watch this start to finish you wont be disappointed WEBINAR: Building A Service Portal Widget from Scratch - YouTube


Rama Chandra D
Kilo Guru

Hi Adam,



I'm not sure, why you would want to do it this way, if I understand your requirement correct.



If the the server script can access parameters of the url using the $sp.getParameter(). So if you want to obtain the filter, you can use something like



$sp.getParameter('filter');



Darshak


Hi Rama,

$sp.getParameter('filter') would grt the filter condition from URL of web page, but the problem is if you use the funnel icon to filter the list,that doesn't update the URL. which leads to the problem if you're using getParameter('filter') function.