Create Unique Constraint with Combination of a Attribute and Association

0
Hi All, Is it possible to create Unique constraint with a combination of attribute and association? Thanks in Advance!
asked
1 answers
1

Hi Nidhin,

This is possible, but you will have to build this in a microflow. Whenever you save the object (Or in a before commit eventflow), you can do a database retrieve on the entity of the object. In this retrieve xPath you want to check the following things:

  1. Object must have the same value in the attribute you want to check
  2. Object must be associated with the same object as the object you want to save
  3. ID must be different of the ID of the object you want to save.

 

This way you see if there is a different object in the database, with the same attribute value and association. If this returns a result, don't save the object, but return a feedback message.

 

Hope this helps!

answered