Implementing table extension framework in Dynamics AX

MicrosoftDynamicsAX2012R3

To implement the table extension framework in Dynamics AX  2012 R3, following are the steps:

Assume that you have table SalesLine and you want to make extension table ISPLSalesLineExtension.

Step – 1: Add Relation

At SalesLineExtension table, add new relation named SalesLine, table SalesLine.

Add a new field ForeignKey -> PrimaryKey based at newly created ISPLSalesLineExtension table. Reference field to the primary table will be added automatically.TEF-1

Note: if the parent table’s primary key is not RecId-based, but the table has CreateRecIdIndex property set to Yes, then the relation on step #1 should be created based on “Single field AlternateKey based”; otherwise the new field will potentially have wrong type, and it will not be possible to use it in the SysExtensionSerializerExtensionMap map.

Step – 2:  Create a unique index for the reference field that points back to SalesLine .
TEF-2
Step – 3 Integrate with the table extensions framework

Add parent table (SalesLine – If it is standard table it might already be exist) to SysExtensionSerializerMap and child table (ISPLSalesLineExtension) to SysExtensionSerializerExtensionMap

TEF-3.1

TEF-3.2

TEF-3.3

TEF-3.4

Step – 4: Create methods at ISPLSalesLineExtension table
TEF-4.1
TEF-4.2
TEF-4.3
TEF-4.4
Step – 5: Create new field PackedExtensions in SalesLine.

This field is available in standard table (Check if already exists)

TEF-5

Step – 6: Add a delete action from the SalesLine to the ISPLSalesLineExtension table.
TEF-6
Step – 7:  Create/Update methods at SalesLine table
TEF-7.1
TEF-7.2
Step – 8: Modify below methods on parent table. (SalesLine)

Check if code already exists if it is a standard table.

public void insert()

{

super();

this.SysExtensionSerializerMap::postInsert();

}

public void update()

{

super();

this.SysExtensionSerializerMap::postUpdate();

}

Step – 9: Please be aware that write method of parent data source (SalesLine) should be modified:

 public void write()

{

super();

ISPLSalesLineExtension.SysExtensionSerializerExtensionMap::insertAfterBaseTable(SalesLine);

}

Write Method of child table triggers first and as a result child record will not be saved as it’s insert and update methods does not allow it without correct foreign key.

Step – 10: Modify Form Code as per below

TEF-10.1

TEF-10.2

TEF-10.7

TEF-10.6

TEF-10.5

TEF-10.4

TEF-10.3

 Feel free to contact us in case of any query.

Technical Consultant

Write a comment