UI Builder: Contents of Repeater components don't refresh after data source is dynamically updated (filter)

Philip Middlema
Tera Contributor

Hi, First post and still relatively new to ServiceNow.

I'm building a page in UI Builder using some repeater components. The repeaters have a nested container which in turn have 3 Stylised Text Components pulling dynamic data using @item... from a dynamic data source bound to the repeater.

I have a dropdown I'm using to allow users to select 1 of 7 options which will affect the filter of the dynamic data I'm pulling in via a Lookup Records. The dropdown updates a client state string parameter on change. This client state parameter is referenced in the data source filter.

My problem is that when the user selects a different option in the dropdown the data in repeater components doesn't update (i.e. they aren't dynamical refreshed when the data source is updated) 

However, linking the same data source to a simple list shows that the dropdown is working when a new option is selected with the list data refreshing as expected. But data in the repeaters does not.

Is this a limitation of the repeater component? or am I doing something wrong?

11 REPLIES 11

Brad Tilton
ServiceNow Employee
ServiceNow Employee

Hi Romu, what I mean by that is for any component or data resource you can bind values/data to those properties dynamically. For example, I might have a client state parameter that holds either "asc" or "desc" and bind that to the sort property on a data resource. When I change the value of the client state parameter, the data resource should automatically refresh. This functionality does not work if you bind a value inside of a filter like the example above.

If you want to refresh a data resource based on something changing on a table, you'll need to use the record watcher data resource for that.

Thanks Brad

so far Im using a setInterval to periodically refresh the DR.

About record watcher for DR, i could not find any documentation (except one pointing to portal widget). Would you have any link maybe?

thanks a lot

Romu

 

Brad Tilton
ServiceNow Employee
ServiceNow Employee

Hi Romu, because of the sheer number of data resources they're not individually documented in docs. There is an effort going to to better document the individual data resources at the time you add them to the page, though.

For the record watcher, you basically add it to your page, point it at a table, and give it some conditions, when a record on the table moves into or out of those conditions an event is fired. In your use case you'd just want to refresh the data resource when the event is fired.

At the end of my creatorcon lab this year I have a section on adding and using the record watcher, so that might be something to take a look at if you get stuck: https://bradtiltonnow.github.io/knowledge/CCL1200/#exercise-5---miscellaneous 

Thanks a lot Brad.

It does not work for me for some reason but I will have a deeper look.

++