Extending table maps used for versioning


Disclaimer: This post describes a proposed solution and is subject to change without further notice

One of the table maps where we have received requests to support the ability to add a field is the PurchLineMap table maps.

This table map is used to describe the set of fields which must be copied between the PurchLine table and the PurchLineHistory table when a new purchase order version is created or editing of a version is reverted. The PurchLineMap is therefore used by the VersioningPurchaseOrder class when archiving purchase order lines.

When additional fields are added to the PurchLine and PurchLineHistory tables using table extensions then it is also a requirement, that this additional set of fields must be copied between the tables when the purchase orders are versioned.

Proposed Solution

To enable the ability for additional models to identify additional sets of fields to be copied, the PurchLineMap table map logic and its usage has been refactored.

The copy logic has been moved to the PurchLineVersioning class, so the VersioningPurchaseorder class is referencing this class instead of the PurchLineMap table map. The PurchLineVersioning class delegates the logic to copy and determine whether a confirmation is required to a set of class instances, that all implement the PurchLineIVersioningFieldSet interface. Each implementing class is associated with a table map, that describes the set of fields to copy.

The PurchLineDictVersioning class is responsible for instantiating the PurchLineIVersioningFieldSet object using reflection, and also for collecting the entire set of fields which must be copied. This data is collected based on all the table maps associated with a PurchLineIVersioningFieldSet implementing class.

The diagram below displays the new classes and their dependencies.

Extension scenario walk-through

Assuming an ISVModule2 model wants to extend the PurchLine and PurchLineHistory tables with additional fields that must be copied when creating a new version of a purchase order.

To perform this task the ISVModule2 engineer must perform the following steps:

  1. Add fields through table extensions to the PurchLine and PurchLineHistory tables.
  2. Create a new table map containing the fields that must be copied, and implement the new table map on the two new table extensions.
  3. Create a new class which implements the PurchLineIVersioningFieldSet interface and implement the required methods.
    1. The copyVersion method must copy data between two records of the new table map type.
    2. The fieldSetTableMapId method must return the id of the new table map.
    3. The isChangeConfirmationRequired method must return true or false based on whether the change to the newly added field values requires a confirmation to be created.

The class and extensions described above are shown in the below diagram:

 

THIS POST APPLIES TO MICROSOFT DYNAMICS AX7 TECHNICAL PREVIEW; IS PROVIDED AS-IS AND CONFERS NO RIGHTS.


Comments (0)

Skip to main content