Handle JavaScript Action call response

0
Good day everyone I am using a nanoflow to make a JavaScript call to my server. The call is successful and returns data. My plan is to display information to the screen.  when i return the object from the JavaScript action,  i get this error message: Value [object Object] cannot be used as Nanoflow variable. What did i miss here? Please help.  
asked
1 answers
0

Hi Onanie, 

Mendix does not know what kind of object is returned by the Javascript action because there is no mapping to an Mendix entity. Therefore you can only return variables like string or booleans but not objects. 

What you can do is store the response in a JSON string and return that as variable from your Javascript action. Then in the nanoflow, as the next activity, use an import mapping to turn the JSON string into a Mendix object. 

 

Another question: what kind of call are you doing to your server, is it a REST call? If so, why are you not using the ‘Call REST’ activity that Mendix offers?

answered