Issue
An AutoNumber attribute increments even when an object is not committed. For example, when creating an object but then deciding not to proceed with committing that object, any AutoNumber attributes of that object will still increment by 1.
Environment
Studio Pro (all versions)
Cause
This is the intended behavior, as mentioned in our Attribute Type documentation:
Each created object will have an AutoNumber that is one greater than the previous one.
As Mendix allows access to the AutoNumber field before committing, a separate value is given for each created object (even uncommitted ones), otherwise there will be conflicts.
Therefore, AutoNumber attributes increment on the creation of an object rather than on the commit of that object.
Solution / Workaround
Since this is the intended behavior, there is no solution. If it is necessary to work around this behavior, implementing custom logic is required. Refer to the community forum posts mentioned in the Additional information section below for examples.
Internal information related
- 176436
- C3T260XGA/p1675249484266259
Additional information
- Mendix documentation: Attribute Type
- Forum Posts: 92677, 110785
0 Comments