In my last post, I had discussed the Extension capabilities of Base enum. In this post I will cover the extension capabilities of tables in AX 7.
There are many table extension examples available in AX7.
Example of
table extension is CompanyImage.Extension
As shown in the above screenshot, For every change of property or node a new XML tag will be created in the underlying XML file.
To demonstrate all the capabilities I have created a new extension of SalesTable : SalesTable.FDDXXXExtension
By default when you create an extension, its name will be <ParentObject.extension>.
You can rename it as you want.
When you compile(build) the object you get the compile error as
follows:
To solve this you need to create an file CompileError.xml as
follows:
You can read more here for the details of the file.
You can do the following in the AX 7 table extensions:
Create new fields
I have created a new string field: VINStringExample.
Create new field groups:
I have created a new group: VINExampleGroup and added my field VINStringExample in it.
Create new index:
I have created a new index: VINExampleIdx. There is a new property available on the index : “Index type”. It can be traditional (row) index and it can column index.
Create new relation:
I have created a new relation: VINExampleRelation. Delete actions are now available on relation itself as shown below.
Create (Pre/Post) Event handler of methods:
I have created a pre even handler for insert method of SalesTable. You need to copy the event handler method. Create new class and paste the event handler code as shown below.
If you go to SalesTable and click on find Event handler you will get the result showing all the event handles created for that method (as below)
Create/Copy event handler method of Event node:
In AX7 we have new node called Event node. There are 40 events available on table.
Similar to pre/post event handler on methods, you have to copy the event handler. Create new class and paste the event handler code as shown below:
P.S. If you create extension for inherited table, Table doesn't sync unless you add the parent table in project.
You can do the following in the AX 7 table extensions:
Create new fields
I have created a new string field: VINStringExample.
Create new field groups:
I have created a new group: VINExampleGroup and added my field VINStringExample in it.
Create new index:
I have created a new index: VINExampleIdx. There is a new property available on the index : “Index type”. It can be traditional (row) index and it can column index.
I have created a new relation: VINExampleRelation. Delete actions are now available on relation itself as shown below.
Create (Pre/Post) Event handler of methods:
I have created a pre even handler for insert method of SalesTable. You need to copy the event handler method. Create new class and paste the event handler code as shown below.
If you go to SalesTable and click on find Event handler you will get the result showing all the event handles created for that method (as below)
Create/Copy event handler method of Event node:
In AX7 we have new node called Event node. There are 40 events available on table.
Similar to pre/post event handler on methods, you have to copy the event handler. Create new class and paste the event handler code as shown below:
P.S. If you create extension for inherited table, Table doesn't sync unless you add the parent table in project.
Very helpful , Thanks for your effort.
ReplyDeleteRegards,
Veer
i've been using this functionality but can't find how to solve following case:
ReplyDeletei created an extension table with a new field for a table , this field should be set/get by using an edit method (because of functional reasons not Always the value of the record itself will be shown)-
i tried created an extension class (extensionOF(tablestr(...)) for the original Table, the class contains the new edit method - i can use it in code, but how can i now assign this to a field group in the table? or on a form?
i tried creating a static class with a static method - but the form does not recognize the code
Can we change any property of field in table extension? I need to change the 'extended data type' property of a field.
ReplyDelete