Retrieve All Rows of an Entity by EntityName String

I have a JSON having a list of Entity Names like : {“entities”: [“Module1.Entity1”, “Module2.Entity2”, “Module3.Entity3”]} The requirement is to read some data from all three entities and apply some business logic, I have tried Java Action, and with the help of XPath, I was able to achieve the same. However, I am looking for a solution where I can retrieve the entities within a Microflow. Is there any way to achieve the same??
3 answers

Hi Tushar,

are you familiar with the Mx Model Reflection module? you could use this module to retrieve an entity by the module and entity name

KR Lukas


There is no builtin functionality within microflows that allows you to retrieve an entity by passing its name as a string.

You can write a general java action to retrieve some entity, but you still need to know at design time, which type you expect, since Mendix cannot handle generalized entity types in a microflow.

If you know the list of possible entities upfront you could model a path for each possible type.

regards, Fabian


I am not sure if this works for the logic you need to execute but I would consider using the  ExecuteOQLStatement Java action from the OQL Module, in which you can build a query to retrieve the information. It will not directly retrieve the objects but it will create objects in a resulting entity. 

For example:

Select * From Module2.Entity2

The ExecuteOQLStatement action executes a given OQL statement.

For each column, the action expects an attribute in a result entity with the same name.
If the result is the ID of an object, it expects an association with the same name (without the module prefix).

Could you elaborate on your use case? How do you know which attributes to work with?