Trigger action when client state parameter is changed.

mmorski
Tera Contributor

Hi, 
In the UI Builder I want to execute "Client Script" when state parameter has change. My first approach was to get the data by Data Broker Server Script, and put 2 actions in "Events":
- Update state parameter
- Execute Client Script

mmorski_0-1747816788549.png

But this operation is asynchronous and in the "Client Script" I doesn't have updated value in client state. Is there any option to force it to be synchronous? Or maybe can I add Event to "State Parameter" itself and trigger executing script when "State Parameter" is changed?

Best Regards

1 REPLY 1

ifti122
Giga Guru

Hi  @mmorski 

You can’t make actions synchronous in UI Builder. The solution is to use UI Builder's event-driven architecture. Instead of trying to force synchronous execution, you should trigger your client script with a separate event that you know will fire after the state parameter has been updated. This is commonly achieved using a component's Input value set event or a page-level Data changed event. This approach ensures your script always runs with the most current value.

Thanks & Regards,
Muhammad Iftikhar
If my response helped, please mark it as the accepted solution so others can benefit as well.