Apply dynamic filter based on data pill/filter component in UI Builder portal experiance

nageswariM
Tera Contributor

Hi Experts,I am building a page using portal experience in UI Builder.

I am having difficulties to do apply dynamic filter conditions based on pill component (Under repeater using Biz Services table as Data resource 1 ) selected value (sysID , which I am setting to client state on pill selected event)  on component2 (under repeater which is Application services table, Data resource 2 > using client state value in conditions ) 

I am getting sysID value and displaying it in the text component in the page for verification.
I need help, How we can pass the selected pill > SysID to Data resource to query and display filtered records?
---------------

Note: I followed client script as well to set client state and used data resource refresh also in the pill event handler using community articles - but didn't work.


Page in UI builder

nageswariM_0-1685697620818.png

 

Configuration

 

nageswariM_1-1685697768366.png

 

Data Resource:

 

nageswariM_2-1685697853111.png

@Brad Tilton @Jon G Lind @Ashley Snyder 

1 ACCEPTED SOLUTION

I would make sure you're using the right value from the payload. You might need to log the payload to the console to see exactly what you're getting.

View solution in original post

4 REPLIES 4

Brad Tilton
ServiceNow Employee
ServiceNow Employee

So by default in UIB if you've bound a client state parameter to a property and the CSP changes, then the component or data resource should auto-refresh. However, I have run into an issue where if you bind a CSP to a part of a property, like part of the filter, the component or data resource does not always auto-refresh. I would add another event handler to your pill component that refreshes your data resource after setting the client state parameter.

Hi @Brad Tilton ,

Thank you it worked now, appreciate your help.
I have a follow-up question on the same page, Above I am using 'Pill' component in the repeater, so I was able to get the selected pill value using @item.value.name it works with the above solution.
Similar thing I am trying to achieve with the  'Filter component' (single selection) - I am trying to set client state using an event when the filter is applied. I am using @payload.value /@payload.value.id - But it it's not working. Would  you help what I am doing wrong here?

nageswariM_0-1685948537178.png

 

Thanks

Nageswari

 



I would make sure you're using the right value from the payload. You might need to log the payload to the console to see exactly what you're getting.

HI @Brad Tilton , Thank you for your guidance. I got it in the console log.

event.payload.appliedFilters[0].values[0] >> has that filter value