Validation rule for associations

Hi there I’m a bit surprised that it’s not possible to define a “required” validation rule for associations. I can create some “before commit” microflows, but when they return false, it appears as a technical error to the user, and adding a “validation message” in the microflow doesn’t work. how do you implement this check ? do you want to vote for this feature ?   Thanks!
4 answers

Let me put my 2 cents here;

  1. The choice of Mendix, not making it possible to validate associations at entity level is related to the following; When associations are involved, most cases it is related to the process. Processes are mainly covered in microflows and have dependencies. Process & dependencies combined → logical result you need a microflow after all
  2. Yes, modeling validation microflows can be a hassle. But someone whispered in my ear that Mx is working on it
  3. Technical error is, because you didn’t tick this box out.
  4. I didn’t vote for you idea; see points 1 en 2


You needs to retrieve the the associated object and pass that object to the validation message so it will shows the validation in that appropriate field. 


Event handlers are triggered just before persisting in your database. So if some validation fails you can stop committing.

It cannot be used for User level validation.

You could probably check if the associated object is created before being saved from the save microflow and show validation message. If the associated object exists the save to database.


in a validation microflow, you can simply check the expression: 

$object/Module.Association_Name != empty