UI Builder: Repeaters bound to Client State Parameters don't refresh when the Parameter is updated

Noah Boltik
Tera Contributor

I have a repeater bound to a client state parameter "selected_projects", which is initially given a value of an array of length 1. The repeater is correctly showing 1 "row" of the contained components. I'm trying to update this client state parameter by using 'api.setState("selected_projects", ["blah", "test"]);'. This is working correctly, I validated that the client state parameter is being updated. However the repeater component doesn't seem to re-evaluate once the client state parameter updates, It will only ever show 1 row. Is there a way to manually tell a repeater component to refresh?

NoahBoltik_0-1675198188909.png

NoahBoltik_3-1675199476011.png

 

Troubleshooting steps I've taken so far: I've bound a client script to a button component such that when the button is pressed, an element is pushed to the "selected_projects" array. I added a log statement, and it is getting updated correctly: everytime I press the button, the length of the array increases. I then changed the "Data Array" property of the repeater to be scripted:

NoahBoltik_2-1675199114176.png

However, when I press the button component I added, the "Test" doesn't get logged. It is only logged when the page loads, not when the client state parameter is updated. 

 

 

5 REPLIES 5

Akshay Pasunuri
ServiceNow Employee
ServiceNow Employee

Even I have the exact same issue. Can someone please suggest a solution to this.

Rahman4
Tera Guru

Hey @Noah Boltik @Akshay Pasunuri 

 

Did any of you guys found a solution for this? It is 2024 and I am in Washington DC and still the same issue. 

 

regards,

 

rahman

No @Rahman4 .

@Akshay Pasunuri I managed to sort out that issue this morning. I needed to do a "Refresh - Data Resource" after updating the Client State Paramter and then the repeater got working. You basically need to Refresh the data resource of the repeater. My scenario was when a user is selecting a group my repeater need to show all the members of that group. I am posting it here in case someone has the same issue. Mark it as answer if it fixes your issue.

 

So this fixed it:

 

Rahman4_0-1715902560640.png

Rahman4_1-1715902730355.png