Alfasith AX

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

Monday, February 25, 2019

COC for class 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.
//[ExtensionOf(ClassStr(ClassName)]
[ExtensionOf(classStr(SalesLineType))]
final class SalesLineType_Extension
{
    public void insert(boolean dropInvent, boolean findMarkup, Common childBuffer, boolean _skipCreditLimitCheck)
    {
        CustTable   custTable;       
        custTable = CustTable::find(salesLine.CustAccount);
        if(!custTable.CreditRating)
        {
             //Your  code to perform action before the event;
        }
        next insert(dropInvent, findMarkup, childBuffer, _skipCreditLimitCheck);       
              //Your  code to perform action After the event;
    }
}

Note: Please make sure you are creating methods with same number arguments and same pattern of arguments as well to the calling methods ie next.


Regards

COC for formDataSourceField 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 field level methods like modified() as
// [ExtensionOf(formDataFieldStr (FormName, TableName, FieldName)]
[ExtensionOf(formDatasourceStr(PurchTable, PurchTable, PurchDate)]
                Final class COCPurchTable_Extension
{
                Public void modified()
{
//Your  code to perform action before the event;
Next modified();
//Your  code to perform action before the event;
}
}


Regards,

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,

COC for form object 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.
//[ExtensionOf(formControlStr(FormName, ControlName)]
                [ExtensionOf(formControlStr(PurchTable, Total)]
                Final class COCPurchTable_Extension
                {
                                Public void clicked()
                                {
//Your  code to perform action before the event;
                                                info("COC is called");
                                                next clicked();
//Your  code to perform action before the event;
                                }
                }
Regards,

Dimension Lookup for both standard and Custom dimension in D365

Hi,  /// <summary>     /// Provides the look-up interaction for the individual dimension value lookup controls.     /// </summary&g...