- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-20-2022 06:56 AM
I am trying to use a Client state parameter in the UI Builder to store multiple inputs (up to 24 different values). Usually for a String state parameter I would use api.setState("parameter_name","new value"); but I can't get this to work for a JSON object. For example if I try api.setState("json_object_name.variable1","new value"); then it does not change the value of the json_object_name.variable1 correctly and if it is changing it then it does not display on a data binded component.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-21-2022 04:39 AM
I encountered this behavior. The solution is the following:
1. make a copy of the JSON state parameter
2. update the object properties in the copy.
3. set the value of the state parameter with the copy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-21-2022 10:24 AM
Thank you Marc the key was to "copy" the json state parameter. Doing something like this shown below seems to be working for me. The only limitation I have found is if you are using the inputValue as a trigger for a data resource, then any time something within myObject is changed then it will think inputValue is also changing and trigger the data resource. A separate state parameter can be used for these cases.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-22-2022 12:17 PM
Hi
I created a JSON client state parameter 'details' 'JSON' {"name":'','age':''}. I'm trying to update the values name and age values from input fields. In the input valid set event, I added an event by selecting 'update client state parameter' and in the client state parameter drop down, I selected data binding option and added @state.details.name and in the value field @payload.value.
When I add input values to the field, as 'chaitanya'. It should update the JSON object as {'name':'chaitanya','age':''}. But it is not updating the JSON. Can you know how to handle this??
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-23-2022 10:00 AM
See my reply to Marc for the best solution that I was able to find. You can make a script that is triggered to run the following. You will have to setup the event handler to add your payload when calling the script.