How to change value by async.run with Petriflow?

47 Views Asked by At

I have an action like this:

text: f.text;

async.run {
   change text value { return "My async text" }
}

But in Mongo, there is no change.

1

There are 1 best solutions below

0
On BEST ANSWER

The change action does not work in the async.run block because at the moment of execution it no longer has the required context to execute properly.

The proper way to do this is to use one of the setData methods. This is the preferred solution, as these methods trigger any set events that might be associated with the data variables you are trying to set.