Microflow runs even after there is field validation error.

i have a form where a field has to have a unique value. when i enter the field 1st time and click save , microflow is configured and it gets triggered and record is created. when i enter 2nd time, the same name and click save , i get validation error that field should be unique , but the microflow still gets triggered. if there is a field validation error,  the save button should not go ahead and trigger microflow, how can this be set..  
2 answers

Hello John Pereira

You can set validation in the Save button using microflow instead of the field validation.

Pass the parameter to that microflow and retrieve using that parameter(Name or any unique values). If returns empty then go with your workflow.

If not then return with the activity if Show message and enter your message that shows to the user.

Hope it helps.


Keeping the field validation in the domain model will best secure the uniqueness. But Mendix can do the validation way earlier, at the frontend. I fiddled some time ago with this frontend validation and it indeed does prevent the microflow from getting triggered. See the example on https://mydemoversion8-sandbox.mxapps.io/p/home, below “Entities” click on "Project” and click new. There you get to see this:

If you need to see the code, you can get this project from github: https://github.com/TimvanSteenbergen/MyDemoVersion8