combination of A and B should be unique in C

0
hi, i've an entity C associated with 2 others, A en B. It must be required for C to have both A and B linked, and also that the combination of A and B is unique within C. So C1 can have A1 and B1, but C2 cannot have A1 and B1. C2 should have A1 and B2 or A2 and B1. how can i do that, there's no option in associations for uniqueness or create a unique index on A and B together. When i try "before commit", i check the existence in the database, and if count<>0, i set it to fail. this works for a first-time creation of a record. But when i first save the data, and change it later, the same microflow finds this record (count=1) and then the commit is cancelled. i tried it with a microflow on the "before create", but then there's a error saying that a microflow should have a parameter. Anyone?
asked
2 answers
2

use [id!=$C-object] in your retrieve action, so you do not find yourself

answered
0

Why don't you check explicitly whether the objects are the same, instead of doing a count? Retrieve the object and do an equality comparison.

answered