Call a microflow with parameter from Javascript

0
Hi guys, I am trying to call microflow with parameter from javascript.  I am using this following code. mx.data.action({ params: { xpath: "//Sample.SampleData", actionname: "Sample.OCH_SampleListfields" }, origin: this.mxform, callback: function(obj) { //Object not required }, error: function(error) { alert(error.message); }, onValidation: function(validations) { alert("There were " + validation.length + " validation errors"); } });   When I am calling the microflow. I am getting this following Error in Browser Console(server responded with status 560). Can you help me solve this problem
asked
3 answers
0

Hello Senthil,

Any error code past 500 is a server-side error, if you investigate you app logs you should get a bit more information. My first guess would be that it errors on the xpath. A reason for that might be the applyto parameter which you don’t have, I believe when using XPath you should also have applyto:”set” .

You should also make sure your microflow has a single input which is a list of the corresponding type to your XPath and you also have access to execute that Xpath.

Hope this helps 

answered
0

Error-status 5xx means that your call did reach the server and the server started processing your request, but something went wrong during the processing. So you are likely to find an errormessage in the log of your server (or modeler’s console if you are running the service locally). So check the log message.

Other option is to debug OCh_SampleListfields to see what causes the error.

answered
0

The first line shows that ‘SampleData’ is null: Change object 'SampleData' should not be null at scala.Predef$.require(Predef.scala:277) 

Check https://apidocs.mendix.com/7/client/mx.data.html on how to pass the ‘SampleData’ along

answered