Create one integer attribute in your entity, You have to call a microflow when you create an object. In the microflow, you should retrieve the last object of your entity by using the Retrieve activity.
You can get your entity's last object by making a range First and sorting an integer in descending order. Now you can achieve this by adding one to the previous int attribute which you retrieve.
If you want to an automatically incrementing number in your entity you just need to create an attribute of type autonumber. There is no need for a microflow to do this.
If you prefer to run your auto-number over microflow in stead of Mendix predefined auto-incement on an attribute, all you have to do is;
once more; its better to use the auto-increment on your attribute.
The suggestions on how to create an autonumber through microflow are only valid as long as you can rule out that two users are running the microflow at the same time, which might lead to creation of the same number twice.
More precisely “at the same time” means that the second user starts the microflow before the first user has committed his new “auto”-number to the database. In this case both users will pull the same old highest number / same entity count and thus will create the same count+1 value.
There is no easy solution to this.
If you can’t directly use type autonumber, e.g. because you need to add a prefix, it might be better to use the autonumber type anyway & derive your prefixed autonumber from that. The microflow for this would look like this: