In AX7 (or D365 for ..), we have two options to customize objects from an existing package, which are overlayering and extensions. On model creation, if you do not choose the package you want to modify using “Select existing package” option you create an extension model and can only change existing objects using the new AX7 extension possibilities. In this article I will mention about the basics of creating extensions (as of update 3 version), give you some tips and try to collect all together various different methods for creating extensions you can find on other resources on internet.

Extensions have several advantages over overlayering method and essential to keep your customizations ‘minimally’ affected from the system modifications done on the lower layers, like hotfixes or service packs. Using extensions instead of overlayering more than “highly recommended” by Microsoft and it seems extensibility is becoming the new modification way for the existing application elements than overlayering. It is already becoming mandatory for all ISVs and might become mandatory in the future for customer projects as well. So I recommend either not using overlayering or using it as few as possible to avoid any such workload of converting everything to extensions in the future.

On AOT it is possible to create extensions for nearly all the object types. On most of them, you can add new nodes to the object (like new fields to a table) or modify some of the existing properties of the object (on every AX update new possibilities are emerging). To be able to do that, you first need to reference the package you want to extend in your model definition the right click the object you want to extend and select “Create extension”.

Capture0

Here I have extended the Invent table and added some new fields :

Capture1

And added new fields to existing AutoReport field group :

Capture2

You can also change some of the properties of table fields and table itself, those are the not grayed out ones when you select the node and check its properties on the designer :

Capture3

If you type “e:” on your designers search pane, you can filter only the nodes you have extended :

Capture4

It is possible to rename the .Extension part of your extension object and you can copy the name of your model here as a good practice. If you check the XML of your new extension object in the model directory (or by ‘right click/Open With..’ on the VS project node and choose ‘Xml editor’ on list) , you will see that it contains only nodes and modifications you have just added and nothing from the base object except the names of the nodes and properties you modified. This highly reduces the risk that your customization gets invalid if a hotfix or service pack is installed and modified the base object :

<!--?xml version="1.0" encoding="utf-8"?-->
<?xml version="1.0" encoding="utf-8"?>
<AxTableExtension xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<Name>InventTable.ExtensionTestBase</Name>
<FieldGroupExtensions>
<AxTableFieldGroupExtension>
<Name>AutoReport</Name>
<Fields>
<AxTableFieldGroupField>
<DataField>description5</DataField>
</AxTableFieldGroupField>
<AxTableFieldGroupField>
<DataField>description6</DataField>
</AxTableFieldGroupField>
</Fields>
</AxTableFieldGroupExtension>
</FieldGroupExtensions>
<FieldGroups />
<FieldModifications />
<Fields>
<AxTableField xmlns=""
i:type="AxTableFieldString">
<Name>Description5</Name>
</AxTableField>
<AxTableField xmlns=""
i:type="AxTableFieldString">
<Name>Description6</Name>
</AxTableField>
</Fields>
<Indexes />
<Mappings />
<Relations />
</AxTableExtension>

On BaseEnum objects there are some exceptions. To be able to extend a BaseEnum object, the ‘IsExtensible’ property needs to be true, which is currently set to ‘false’ in many of the system layer enumerations. And, if you define an enum as extensible, you cannot use enum values anymore (the property ‘UseEnumValues’ has to be ‘No’), which is a very unfortunate limitation. The integer value of the enum elements is not fixed if you define an enum as extensible (or use enum values set to ‘No’). In such extensible base enums, you cannot parse integer values into your enumeration variables, and cannot use greater or smaller (< >) operators as (priorityEnum1 > priorityEnum2). Moreover if you send your enum fields in a custom service, you cannot send or receive them as integer values. Hope in the future this limitation will be removed.

Capture5

It is also possible to extend Labels. To be able to do that, you create a new label file with _Extension suffix, such as GLS_Extension. Then you can either modify existing labels or create new ones within this label extension. Note that if anyone else has already created an extension before for any of the labels, you can add an integer next to the suffix to overcome the conflict, like GLS_Extension1.

That is all about this part of the blog, in the next part we will have a look at code extensions and eventhandlers and delegates (called ‘hooks’ by dynamics team) that can be used for extensibility.

For more information on application object extensions you can check the wiki aritcle at : https://ax.help.dynamics.com/en/wiki/customization-overlayering-and-extensions

 

One thought on “AX7 Extensibility – Part 1 : Application object extensions

Leave a Reply