Is there a way to refresh a repeater component in UI Builder after a specific interval of time?

User660846
Tera Expert

I have a requirement of refreshing a repeater component in UI Builder after 2mins of a button click.

Is it possible to achieve?

7 REPLIES 7

You won't need to refresh the repeater component itself. If you have the data from the data resource bound to the repeater, the repeater will auto-refresh if any of the data bound to it changes so the refresh of your data resource will refresh the repeater.

DR9
Tera Contributor

That is not what I am seeing. I have a data broker passing an array to a repeater that repeats over 3 fields for each item in the array. When I set the first field to "no", within a client script I set the data broker's array data of the other two fields to "1234". I validated that the data broker's array data(at the correct index) now displays the new value of "1234", but there are no changes to the two on the UI. It is still showing the onLoad values from the data broker. 

 

I need to be able to update items within a repeat with code and I cannot use client state parameters since I am using a repeater with n number of items.

 

Is there another way I should be updating the data?

Nootan Bhat
Kilo Sage

Hi @User660846 ,

You can call the client script form the Button. And in the client script you could use the helpers settimeout method as mentioned in https://developer.servicenow.com/dev.do#!/reference/api/utah/client/helpersAPI#helpers-timing-setTim...

Inside this timeout method you can call the data refresh event for the data which you are using for your repeater component. 

As mentioned by Brad, repeater component can use the dynamic data from the data resource so if data source is refreshed automatically repeater component will update the data as well.

 

Please mark my solution as Accept, If you find it helpful.

 

Thanks