How to make Relation in Extended Data Type and add 'View Details' for field on a form in AX 2012

Because AX 2012 is not support  for add relation to Extended Data Type like in AX 2009.
This is my solution how to do it in 2012:
- Duplicate an EDT have relation in AX 2012: ex SalesId and change name. relation table, reference table to yours -> you have an EDT with relation

**** If your project have been customized already and have a lot tables with field extend from your EDT, you don't need to change  EDT property in each table (because it takes lot of time). Follow these steps:
- Export your Proj xpo (with old EDT too)
- Delete old EDT, rename duplicated EDT to your EDT ( now tables with fields extended by your EDT lost all EDT property)

- Import project without old EDT ( auto fill property for all extend field)

The filed with EDT have relation auto add 'View Details function on form (Right-click a field in a form, and then click View details)

***1 more way to add 'View Details' with field not extend from EDT
Open the form in the AOT, expand its data sources, and override jumpRef() of the field on the your datasource with the following code: 

public void jumpRef()
{
YourTable name;
Args args;
MenuFunction mf;
name = YourTable ::find(YourTable.fieldId);
if (!name)
{
return;
}
args = new Args();
args.caller(element);
args.record(name);
mf = new MenuFunction(menuitemDisplayStr(YourForm),MenuItemType::Display);
mf.run(args);
}

No comments:

Post a Comment