Events
Power BI DataViz World Championships
Feb 14, 4 PM - Mar 31, 4 PM
With 4 chances to enter, you could win a conference package and make it to the LIVE Grand Finale in Las Vegas
Learn moreThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
When new fields are added to the PurchLine and PurchLineHistory tables using table extensions, the new fields must be copied between the tables when a purchase order is versioned. The PurchLineMap table map specifies the fields that must be copied between the PurchLine table and the PurchLineHistory table when a new purchase order version is created or edited. To accomplish this, extend the PurchLineMap map table to include the additional fields. Additionally, the PurchLineMap is used by the VersioningPurchaseOrder class when archiving purchase order lines. The model is shown in the following diagram.
To be able to specify new fields to be copied, the PurchLineMap table map logic and its usage have been refactored. The copy logic has been moved to the PurchLineVersioning class, so the VersioningPurchaseOrder class references the PurchLineVersioning class instead of the PurchLineMap table map. The PurchLineVersioning class delegates the logic to copy the fields and the logic to determine whether a confirmation is required from the classes that implement the PurchLineIVersioningFieldSet interface. Each class that implements the interface is associated with a table map that specifies the fields to copy.
The PurchLineDictVersioning class instantiates the PurchLineIVersioningFieldSet object using reflection. The PurchLineDictVersioning class collects the entire set of fields which need to be copied. The field data is collected based on all the table maps associated with a class that implements PurchLineIVersioningFieldSet. The following diagram displays the new classes and their dependencies.
Suppose that you want the ISVModule2 model to extend the PurchLine and PurchLineHistory tables with new fields that must be copied when creating a new version of a purchase order.
Note
You must have developer access to the ISVModule2 model.
To complete this task, you must perform the following steps:
The classes, interfaces, and extensions described in these steps are shown in the following diagram.
Events
Power BI DataViz World Championships
Feb 14, 4 PM - Mar 31, 4 PM
With 4 chances to enter, you could win a conference package and make it to the LIVE Grand Finale in Las Vegas
Learn moreTraining
Module
Extend and modify an existing table in Dynamics 365 Business Central - Training
Do you want to add extra fields to an existing table? This module discusses how you can modify an existing table by using table extensions.