How do I generate a random long number?

0
I want to generate an UID for every row inserted in a form. I don't want an auto number incrementing
asked
2 answers
2

The RandomHash action in the Community Commons module in the Marketplace can generate a UUID.

https://docs.mendix.com/appstore/modules/community-commons-function-library/#39-stringutils

You can also add an After Create action to call this and set an attribute when you create your object.

https://docs.mendix.com/refguide/event-handlers/

I hope this helps.

answered
0

HI Syrine

 

If you want UID to be unique and not generated every time you read the object, you need to not create calculated attribute. 

UID should be stored. 

And then in Before Create/After Create event microflow you can generate unique code and assign it to UID. 

This way Microflow will be called once and UID will not be regenerated.

answered