Retool state engine is confusing

I just wasted a good few hours on trying to get the Retool state to work. I have an editable table that I need to process and save the values after the change inside another object. So I am not updating a database, I’m just updating a variable.

To do this, in the save action for the table I access the changeSetObject. Here is the crazy thing. In the state view the changesetObject is visible but if I use it in the script it is null.

console.log(mytable.changesetObject); shows as undefined even though mytable.changesetObject clearly shows up with content in the state viewer.

My fix is quite fugly but it works and I don’t understand why. Is there no better way.

const chob = JSON.parse(JSON.stringify(mytable.changesetObject));

Now chob is a change object that I can work with. Anything else yielded undefined.

Hi @Chris_Laurie,

Can you share a screen recording of the Javascript query that runs the console log not displaying table1.changesetObject ?

Or share the save script not showing it either? Are you self hosted or is your org on our cloud?

Hi @Chris_Laurie,

Just wanted to circle back on this, the changesetObject should be accessible to use in scripts to use if you want to update the value of a variable using .setValue(), I am wondering if the linter might be previewing the changeset as null :thinking:

The one thing would be if you are looking for changes when there have not been any made yet.

Let me know if you were able to test out what I shared in the Loom video. I would love to check out your app in office hours as well to see what could be causing the table's state to return null.