Dynamics AX 2012 Foreign Key Constraints

axapta, dynamics-ax-2012, foreign-key-relationship

Solution

When setting the properties on the relations, set `UseDefaultRoleNames` to No, then give each relation a unique `Role`.

Problem

Let's say I have two tables: ``` Items Property1 (relates to PropertyName) Property2 (relates to PropertyName) Properties PropertyName (index, single key alternate) ``` When making a normal relation in Dynamics AX 2012, I get the following Best Practice error: Only foreign key constraints are allowed on this table. I can create a single key alternate foreign key relation to fix the best practice error. However, I can only do this for one of the fields. If I do it for both, I receive a compilation error about duplicate alternate keys. Is there some way to create normal relations like we used to in AX 2009 without a best practice error? or.. How can I do two foreign key relations on two fields that relate back to the same column? Thanks

Original source