Export functionality does not export the model's Table constraints

This article provides a resolution for the issue that the Export functionality in Microsoft Dynamics AX 2009 does not export the model's Table constraints.

Applies to:   Microsoft Dynamics AX 2009
Original KB number:   2464353


Microsoft Dynamics AX 2009 allows users to export product models, and import them into new product models, in either the same company, or new companies. When exporting product models however, Table constraints are not included. When importing the models, users must manually add the Table constraints.

Below possible scenario where Table constraints are not exported.

  1. Open the menu path Product builder/Setup/Table constraints.

  2. Create a new record with the following values:

    Table constraint ID: InventTable
    Name of the table constraint's table: InventTable

  3. Create a new record in the lower grid with the following values:

    Field name: ItemGroupId
    Variable: ItemGroupId

  4. Create a new record in the lower grid with the following values:

    Field name: ItemId
    Variable: ItemId

  5. Save the records and close the form.

  6. Open the menu path Product builder/Common Forms/Product model details.

  7. Create a new product model by selecting Ctrl+N on your keyboard and finish the wizard with selecting the Finish button.

  8. Open the product model by selecting the Product modelbutton.

  9. On the Product Model for select the Table constraints tab, create a new record with Constraint table id: InventTable and save the record.

  10. In the Select variable group dialog, enter Basic in the Group dropdown and select OK.

  11. Close the form so we are now back on the initial Product Models form.

  12. Select the Functions button/Export product model and specifies a path and file name on the local hard drive.

  13. Select OK.

  14. Select the Functions button/Import product model and select the file created above during the export.

  15. Select OK.

  16. In step Delete following tables dialog, select the button No to all and then select OK.

  17. A warning may be returned stating Group Basic and variable ItemGroupId and ItemId both already exist. This is expected.

  18. Select the newly imported product model and select the Product model button.

  19. On the Table constraints tab, the user notices the table constraints are not imported.


Table constraints are not included in the export logic for Product models. The Table constraints are not included in the exported data. This due to possible issues when Modeling variables exist with the same variable name.


A code change will allow including the Table constraints during the export of a model.

Class method PBAExport.newPBAExport:

Add code which makes the last lines look like this:


return Export;

This includes the line Table constraints linked to the product model in the export and allows to import the table constraints.

More information

This workaround requires the Table constraints to exist in Product builder/Setup/Table constraints. This is important if table models are imported in other companies or on other databases. It does not allow exporting the table constraints (PBARuleTableConstraint), and table constraint fields (PBARuleTableConstraintColumn). This is due to validation limitations during import on existing variables with similar variable names. If required, you can manually export and import these two tables using the data export/import functionality in module Administration.