Unique validation in Microflow

0
Good Morning,   I want to put a unique validation rule in a microflow so that all validations show up at the same time when save is selected. I can’t work out how to add in the validation rule for having an object unigue, into the microflow. So for Full name – I would like it to be unique as well as required. Does anyone know?     Thank you  
asked
4 answers
8

Hello Jessica,

 

Regarding validation you can achieve it by two different ways one way by configuring the validations from the properties page of the entity, 

 

And the another way is by using microflow on the save button of that new edit page..

In this microflow you can check whether the value for that attribute is entered or not by using the decision box and then you check whether it is a unique value or not by retrieving object from the same entity by using same attribute value as xpath.

Below image is for your reference 








Hope this helps you!

answered
1

Hi Jessica,

 

You can simply attempt to retrieve your entity with the inputted value – if it is already in the database then it is not unique. Your XPath would look something like this:

 

[FullName = $value]
[id != $ObjectToCompare]


You can then simply use a validation feedback activity. Similar to this:

​​​​​​

answered
0

You can add a ‘Unique’ Validation rule in the entity:

Validation Rules in Mendix

answered
0

In the microflow where you commit your object:

 

  1. Create an exclusive split where you check if the field is not empty. This is your validation on empty field, if it returns empty then show a feedback message.
  2. For the unique name: retrieve an employee from database with the name the user has entered on his view. If the result of this retrieve is empty then it’s not being used yet and therefor unique. Another option is to use an onchange microflow on the input field so the user knows instantly if the name is unique or not.
answered