Temporary State Object setIn() for inserting Key Value pairs

after spending 2 days trying to figure out how to use setIn() to insert Key Value pairs into a temporary state I figured I'd try to help others.

The biggest piece holding me back was initial value as if you set initial value of the temp state to 0 or null you can not properly use setIn

Please set your initial value to {} in order to declare it as an object in turn allowing setIn to work properly.

here is an example of a Table event handler for row click - run script where i declare keys and values into a temp state that is passed to a Module in which i can configure which buttons to show or hide as well as which invoice template to use for the desired company in quickbooks, it is still in development and will end up with many more keys as I go but as it took me a lot of digging to figure it out I'm hoping I can speed up the process for others.

stae1.setIn(["formstate"], 1)
stae1.setIn(["invoicetemplate"], "1")
stae1.setIn(["object2","nestedkey"], "num6") <-- and example of nested key insert
tabbedContainer1.setCurrentView("View 5")

the video that really helped me out is here


Thank you so much for this write up, Nate :pray: I’ll pass this feedback to a few teams and in the meantime, would you mind if I moved this thread to either our App Building or Community Show & Tell section for increased visibility?

Whatever you think is best. I read all the documents I can when I can't figure something out. This one was buried in a video and I have seen others searching for similar scenarios so I figured I'd try to help