New Mendix Action: Create or Update Object
Idea
A reusable action that combines Mendix's Create Object and Change Object functionality into one configurable action.
The goal is to reduce repetitive Microflow development, avoid duplicated logic, and make object handling easier to maintain.
Currently, I often need separate Create Object and Change Object activities, even when most of the attribute logic is identical. This action would combine both operations and allow developers to configure what happens depending on whether the object is new or already exists.
1. Automatic Create or Update detection
Pass an object into the action.
The action automatically determines what operation to perform:
New/empty object: Create a new object.
Existing/persisted object: Update the existing object.
No separate decision or duplicated Microflow logic should be necessary.
2. Attribute configuration
For each attribute, provide two independent configuration options:
On Create
On Update
This allows developers to decide which attributes should be populated or changed during each operation.
Example:
Attribute | On Create | On Update |
Name | ✓ | ✓ |
Description | ✓ | |
Building ID | ✓ | |
Created Date | ✓ | |
Modified Date | ✓ | |
Energy Class | ✓ | ✓ |
Attributes can therefore have:
The same logic for both operations.
Logic only when creating an object.
Logic only when updating an existing object.
Different logic depending on the operation.
3. Duplicate attribute configuration
An optional but useful feature would be the ability to duplicate an attribute configuration row.
This would be particularly helpful when the same attribute needs different conditional logic for Create and Update.
For example, a developer could duplicate an attribute and configure one row for creation and another for updating, without having to recreate the entire configuration.
This could also simplify more complex conditional expressions where the logic is almost identical but has a few differences.
4. What happens after Create or Update?
The action should allow developers to configure what happens with the object after each operation.
For example:
After Create: Add the new object to a selected list or association.
After Update: Add or retain the updated object in a selected list or association.
The two configurations could point to the same list or to different lists.
5. Return operation result
The action should return an operation result indicating what happened.
Preferably an enumeration rather than just a Boolean:
Created
Updated
Or just set a value to a Boolean-varible
This allows developers to use a subsequent decision in the Microflow to execute different logic depending on the operation.
6. Potential extensions
The concept could potentially support additional functionality in the future:
Support for different entity types.
Association handling.
Configurable commit behaviour.
Optional validation before committing.
Reusable attribute configuration.
Benefits
Less repetitive Microflow development.
Less duplicated Create and Update logic.
Easier maintenance and better readability.
More consistent object handling.
Faster development, particularly for entities with many attributes.
The main idea
Instead of building separate Create and Update logic in every Microflow, developers should be able to configure one reusable action that automatically handles both operations.
Configure what should happen, rather than manually building how it should hoppen.
I'd be interested to hear whether other Mendix developers see value in this concept and whether they think it would be best implemented as a custom action, a widget, or a combination of both.