I am using nodeState.putShared(“counter”, 1) in first scripted node and in second scripted node I get the value and increment it and put it back in nodeState.putShared(“counter”, 2).
However, I am expecting the last value set that is 2 when i do nodeState.get(“counter”) in any subsequent node but I get the initial value that is 1.
Tried to remove the variable from nodeState.remove(“counter”) but still does not help, it returns the first value set.
How to override/update the value set in nodeState.putShared() ?
As a workaround, you can replace
nodeState.putShared(“counter”, 1) by
FYI: IDCloud is to deprecate the bindings
transientState per OPENAM-17666.
Also, I would suggest printing out the value to logs to inspect what is going on. I do expect the counter to be updated. Also, please note, the
get(key) method retrieves the state for the key from the
NodeState in the following order:
shared. So, if you have the same key in the transient state, the method returns the value from the
transient state first.
Unfortunately, this looks like a bug. I also expected the counter would be updated, but using t.he putShared method seems to only work if the key is not already set