In many microflows, a single Retrieve action isn’t enough. We often need a “get or create” pattern:
To handle this, I frequently build a reusable SUB_GetOrCreate microflow/nanoflow per entity type. However, to better support the DRY principle and reduce repetitive logic, I would like to suggest enhancing the Retrieve action to optionally support GetOrCreate behavior in one action.
In the retrieve action, give developers an option to have "Get Or Create" functionality so that if retrieve returns no object, Mendix automatically creates a new instance of the selected entity with the assigned attribute values.
We can accomplish this by adding a checkbox in the Retrieve action configuration:
[_] Create if not found
When enabled: Retrieve action UI expands (similar to the Create Object action) to allow setting attribute values for the newly created entity.
This would streamline common patterns, reduce number of steps in flows, and make microflows/nanoflows easier to read and maintain.