In Mendix, if a variable already exists you cannot create another variable with the same name — you can only change its value. The main confusion here is that the Change variable activity does not work for object variables. It is only meant for primitive types (like String or Boolean). For objects, you need to use Change object instead. If this still doesn’t fully address your issue, please explain the customer requirement and what you are trying to achieve in a bit more detail, and I’ll try to help again.
Hello Devesh,
I believe the issue here is you are creating a variable (create variable) instead of what you really want to create that should be an Object variable (create object).
Variables have different types (string, int, long etc) While objects reflect an instance of an entity.
So in your case create an object and when you pick the entity choose the object type you want to create on the "select".
Hope this helps.
Create Variable is used to store temporary, simple data inside a microflow. You create primitive data types such as String, Integer, or Boolean, and they only exist while the microflow is running. It is typically used for calculations, storing intermediate results, or holding temporary text values. These variables are not entities and are not written to the database.
Create Object, on the other hand, creates a real instance of an entity. This means you are creating an application object that has attributes and associations and can be committed to the database. It is used when you want to create actual records, such as a new user, order, or form data.
In short, Create Variable is for temporary values, while Create Object is for creating entity-based data records.
So i want to keep the variable ingredientExisting to ingredientExisting only if it exist but its showing a issue that name with same variables cannot exist i tried using gpt for the issue it says assign the variable so what should we do about it. i am not able to use change variable option since my object type is not visible there.
hi,
In Mendix 10.24, the behavior you’re seeing is by design and matches the official Mendix documentation.
In recent Mendix versions (9 and 10), there is no separate Assign Variable activity.
The two supported variable activities are:
This is documented under Variable Activities in the Mendix Reference Guide.
The Create Variable activity only supports the following data types:
Mendix does not allow you to select an entity object type in Create Variable. This is normal.
If you need an object variable (entity instance), you must use:
These activities automatically create a variable of the appropriate entity type for use later in the microflow.
If your goal is to work with an entity instance, the correct pattern is:
This is documented under Object Activities in the Reference Guide.
This is the correct and supported way to manage variables and objects in microflows in Mendix 10.24 LTS.