Hi Constanza,
As per my understanding username (name) field is there in system module of Mendix project,
there if you check, it already has a validation rule that name should be unique.
If you are building something custom you can also try to do it in the similar way and have validation rule on entity level for uniqueness.
Hope this helps!
Sunit Kumar Dubey
Hi Constanza,
I assume you don't use the userlist anywhere else in your flow? If this is the case, you can add a XPath to the retrieve [Name = $ValueToCheck] and only retrieve first. In the split you can check whether a user is found.
The $ValueToCheck should be the username you filled on the form, I guess you can pass this as input parameter?
Hope this helps!
so I did this and works like well, also in the decision later I use $UserList= empty
Sunit, you just use it in the validation section of the username field?
Hi Constanza ,
If you have a entity validation already , actually you do not need to implement it again in the microflow ,
As , while saving the data Mendix will do the check automatically.
I will suggest you try to add two accounts with same username and just do not modify the default page or microflow ,
you will still see the validation message on the username if it is not unique as it is defined on the entity level.
Please try it out and let me know in case of any doubt.
Regards,
Sunit Kumar Dubey
Hi,
please find the below screen shot, it might help you.
The save microflow will be having a parameter where the name is Store ( The value which is set to name in the account entity). Add a retrieve from the database and select range as first and add your xpath and validate again the name attribute. In your Decision, you can just check if the object if empty or not.
if the retrieve yields a value the name already exits.
Hope this helps you.