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.
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 .
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
Step – 4: Create methods at ISPLSalesLineExtension table
Step – 5: Create new field PackedExtensions in SalesLine.
This field is available in standard table (Check if already exists)
Step – 6: Add a delete action from the SalesLine to the ISPLSalesLineExtension table.
Step – 7: Create/Update methods at SalesLine table
Step – 8: Modify below methods on parent table. (SalesLine)
Check if code already exists if it is a standard table.
public void insert()
public void update()
Step – 9: Please be aware that write method of parent data source (SalesLine) should be modified:
public void write()
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
Feel free to contact us in case of any query.