Alfasith AX

Alfasith AX
اللَّهُمَّ انْفَعْنِي بِمَا عَلَّمْتَنِي، وَعَلِّمْنِي مَا يَنْفَعُنِي، وَزِدْنِي عِلْمًا

Monday, February 25, 2019

COC for formDataSource methods in D365


Hi,
COC- Chain of Commands are used to override the Application suite objects.
In certain cases, like the code with public and protected access specified methods cannot be created a post or pre event handler by coping its event.
In that case we need to go with COC.

This can be achieved by using the keyword ExtensionOf() to load the object and next() as super.
Note: COC class needs to final and method that to be COC can be public access specifier.
Example. COC of form button event.
Similarly for all the places like datasource methods like insert() as
// [ExtensionOf(formDatasourceStr (FormName, TableName)]
[ExtensionOf(formDatasourceStr(PurchTable, PurchTable)]
Final class COCPurchTable_Extension
{
                Public void insert()
{
//Your  code to perform action before the event;
Next insert();
//Your  code to perform action before the event;
}
}
Regards,

1 comment:

How find size of recordsortedlist in D365/AX 2012

Hi, This is the continuity of the previous article where we are now getting the size of recordsortedlist . if(recordsortedlist.len() >1) ...