Best Practice Error

Only foreign key constraints are allowed on this table - How to rectify this best practice error.

Hope this Helps !


This Best practice error comes when we create a normal relation. so for that create an index for the field on which you want to create a relation, and set the AlternateKey property of the index to “Yes”. Now go to this table properties and set the PrimaryIndex property to the newly created index.Now when you create a foreign key based relation on the child table it will automatically create a relationship on the field that you have set as the PrimaryIndex. so in this way you can create a normal relation through foreign key relation and you can get rid of this Best practice error.


Table1 → Field1,Field12

Index1 → Field1 having AlternateKey set to Yes”.

Table1 → properties->PrimaryIndex set to “Index1”.

Table2 → create a foreign key relation (Foreign key → Primary key based)

then automatically a reation Table2.Table1 ==Table1.Field1 is created.

In this way you can easily create a relation on any field other than RecId. and also the BP error Only foreign key constraints are allowed on this table will remove.

Hope this might solve your problem.if it does then do reply here.


Muhammad Yasir


I am facing the same problem.

In my case, I am applying this on standard table, so i cannot change table1 primary key with newly created Index.

I am creating a relation from foreign field in Table1 to another foreigh key field in Table2.

here table2 is an temporary table. so can you please suggest any other way to rectify this BP error.

Thanks in advance.