application-serverpetri-net

How to change value by async.run with Petriflow?


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.


Solution

  • 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.