Validation has an intermittent bug. See description.

1
Hi, There is a validation set to prevent the same vehicle being added to a list of vehicles in the database. At the moment, the validation works by the user inputting a registration number and then a microflow is called that retrieves all the vehicles in the database, another activity does a find in the list and searches for a vehicle with the same reg no. as the one entered. This validation works sometimes and randomly, some reg numbers would bypass the validation. When i test the app in my local version, it works fine, it never bypasses the validation, however, in the test environment, it sometimes would creep through and bypass the validation. Do you know why this is or how it can be fixed? This ticket includes a secure attachment. Use this link to access the attached files: https://mendix.sendsafely.com/receive/?thread=NNGT-DP69&packageCode=04lfmHQlv5K5KwQjYxnDxKsSV0RzEW5tBUuMBCwy9fw#keyCode=QpY0GdTRTnPg_p7T0ZHq5B37ZztOtDJIsYFlWrYF1oY
asked
1 answers
0

Maybe an issue with concurrency, so the number is added after the retrieve of the complete list is performed, then this new number is not in the list but will exist in the database.

Maybe add a unique constraint on the entity level via the validations, then this will make sure the number is added only once.

Anothe roption would be not to retrieve the list and check in the list, but rather do a retrieve from the db with something like:

[RegistrationAttribute = $registration][ id != currentobject] followed with a decision if the record is found

With an index on the registrationattribute this is very fast and will prevent the concuurency issue, will perform faster and will consume less memory (certainly when the amount of registrations grows).

I hope this points you in the right direction.

answered