call nanoflow with param different from context

3
Hi everyone, There is a new api in mx.data to call nanoflow. Supposed i create a new non-persistant mxObject and want to call a nanoflow which accepts the object as param. How could I do this with the new Api? Should I create a new MxContext and set context to it before call the nanoflow?  Suppose I have a list, does the nanoflow support it? Best regards,
asked
1 answers
3

Hi,

That is a very good question indeed.  I would expect that it is possible to do the call with a single object at least, if not with a list. But it does seem like it is not possible. Also, creating a new context seems to be discouraged "This class should never be instantiated manually." as the Mendix docs clearly states.
A possible workaround might be to always associate new objects that you create to the object in context and then do a retrieve by association in the nano-flow.

-Andrej

EDIT:
Perhaps you can try the following trick: Change the current context, call the nano-flow and then restore the original context;


var prev_entity = context.getTrackEntity();
var prev_id = context.getTrackId();
context.setContext("NewEntity", newObjectGuid);
callnanoflow(...);

context.setContext(prev_entity , prev_id);

 

answered