Get Nanoflow result in widget

1
I am building a widget that should get the result of a nanoflow and do something with it. Currently it is just a string to display in an alert (for testing purposes). The code I am using comes directly from the client api documentation (https://apidocs.mendix.com/7/client/mx.data.html). mx.data.callNanoflow({ nanoflow: this.nfReturningClass, context: this.mxcontext, origin: this.mxform, callback: function(returnedString) { alert("Nanoflow result " + returnedString); }, error: function(error) { console.log("Nanoflow error"); console.log(error) } }); I know the nanoflow is executed, as I have put some logging in it. However, the result I keep getting is: Error: Did not expect an argument to be undefined. I took a look at some other widgets that implement nanoflows, but none of them seem to do something with the result (just run the nanoflow). Am I doing something wrong? Has anybody successfully got a result from a nanoflow and used it in a widget? Or is this not fully implemented yet and perhaps the documentation is a bit ahead...
asked
2 answers
0

No, have not seen it working yet. But first thing to check: Does the nanoflow return a String? And is the returned string not empty?

answered
0

I have called nanoflows that return a boolean, and that is what I get. No object or JSON structure just a plain return value. Does the nanoflow expect the same object as the context object of your widget? If not, you need to create a context with that object:

 

var nanoflowContext = new mendix.lib.MxContext();
nanoflowContext.setTrackObject(someMendixObject);

 

answered