There are a number of ways to invoke a microflow, and get the result passed to the callback handler. The preferred and easiest way is using mx.processor.get:
mx.processor.get({
microflow : "Module.Microflow",
guids : [ obj.getGUID() ],
callback : function(result) {
// result.actionResult will contain the return value
}
});
mx.ui.action is an alias of mx.processor.action, but in addiction it provides the possibility to show a progress indicator while the microflow is executed. With mx.ui.action calling the same microflow would look like this:
mx.ui.action("Module.Microflow", {
params : {
applyto : "selection",
guids : [ obj.getGUID() ],
},
callback : function(result) {
// result.actionResult will contain the return value
}
});
With mx.processor.action this would do exactly the same as the above calls:
mx.processor.action({
actionname : "Module.Microflow",
applyto : "selection",
guids : [ obj.getGUID() ],
callback : function(ioArgs, result) {
// result.actionResult contains the return value
}
});
It is not recommended to parse the json result yourself, since the response may contain Mendix objects. These objects should be instantiated, before they can be used or manipulated.
I believe that you need to set your processedOuput to
dojo.fromJson(dojo.isIE ? response.xhr.responseText : response.xhr.response).actionResult;
As in IE the xhr response (I recall only checking IE 8) is a property called "responseText", where other browsers (checked in chrome and firefox) it is a property called "response".
Here are some small fixes which should get you on long way.
Thank you all for your answers; seems like the tutorial is a bit outdated, but this forum is working just fine :-) I'll incorporate these changes this weekend and tell you the result; thanks already.
I believe that you need to set your processedOuput to
dojo.fromJson(output.xhr.responseText).actionResult