How to use variable created in a microflow

0
Probably very dumb question as i am a total newbie to Mendix: I created a button that calls the REST API of a specific web-service of mine. Call is functioning well, values (ony a simple string in this case) are retrieved. Now i want to display this string in a textbox in a page that also contains the original button. No clue how to do such a simple thing. I already assigned (by create object) the string to an attribute of a new created entity. I hand over that entity as a result of the microflow. But on the UI side i am lost, where that entity instance went …. what can I do? I do not get the concept of entity instances in Mendix. How do i find them?
asked
2 answers
6

All data shown on pages in Mendix are based on objects in your data model. So, to show data on a page, the page be given an object in a data view or list view.

Typically, you’d create a non-persistent entity in your domain model for this. Let’s call it RestHelper. On that entity, add a string attribute that will hold the output of your REST call. Let’s call that attribute OutputValue.

Then, the page you describe in your question should have a data view with a button inside of it. Your data view’s data source should be a microflow that creates and returns an instance of the RestHelper. Also inside the data view you should include a text box linked to the OutputValue attribute. This will eventually hold the output from your REST call.

When you click the button, you will now be able to pass the object into the microflow as a parameter. After the REST call, you can use the “Change Object” activity to set the value of RestHelper.OutputValue to the variable retrieved from the service.

Hope that makes sense. Please feel free to comment if you have any questions.

answered
1

Hi there,

using non-persit entity and make it associate with the object that you show on the page, then add the field of the non-perist to the page.

 

hope this help

answered