To call a microflow or nanoflow from a widget use the client API: https://apidocs.rnd.mendix.com/8/client/mx.data.html
Here is an example that passes an object to the microflow:
mx.data.action({
params: {
applyto: "selection",
actionname: "MyFirstModule.GetFavoriteFood",
guids: [ "281530811285515" ]
},
origin: this.mxform,
callback: function() {
console.log('done');
},
error: function(error) {
console.error(error.message);
}
});
Note that it is currently not possible to send more than one parameter (unless it is a list of the same entity) or to send primitives such as string, boolean. As a workaround set a string attribute on an object and use that instead of a primitive string variable.
Hope this helps!
PS: Sorry for the bad formatting, the code widget wont accept any new lines
Declare a property of type “action” in your .xml
<property key="<key>" type="action" required="true">
<caption></caption>
<description></description>
</property>
Use this in your component like this:
if (this.props.<key>) {
this.props.<key>.execute();
}
If the configured action has a parameter the widget will derive this from the entity context you placed the widget inside of.
Take a look at this manual https://docs.mendix.com/refguide/javascript-actions n how to call a nanoflow from a javascript. You can pass the nanoflow as a parameter. See section 2.2.2
For calling a microflow: you can call a microflow from a nanoflow. So it takes two steps, but then you are there.