To find the Primary- foreign key mapping in AX:

Hi,
To find the mapping between primary and foreign key, use the following code……

static void Job3(Args _args)
{
TableId tableId1 = tableNum(VendTrans);
TableId tableId2 = tableNum(VendInvoiceJour);
DictRelation dictRelation;
DictField field, relatedField;
int i;
setPrefix(strFmt(“%1 -> %2″, tableId2Name(tableId1), tableId2Name(tableId2)));
dictRelation = new DictRelation(tableId1);
dictRelation.loadTableRelation(tableId2);
if (dictRelation.lines())
{
for (i = 1; i %2”,field.name(DbBackend::Sql), relatedField.name(DbBackend::Sql)));
}
}
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s