COC to create custom method for forms


We can extend the logic of public and protected methods without having to use event handlers. COC, allows to use the method local and global variables. COC must be end with _Extension.


Form level method :
System search there are any extend methods , If Extend method is exist,run COC method first , next() method Invoke Standard form methods.


Form Custom method:

    [ExtensionOf(formstr(CustTable))]
final class CustTableForm_Extension
{
    public amount getAmount(amount _amount)
    {
        //Here we can get buffers,Add logics and change parameter as per our business requirement.
        Amount   retAmount =next getAmount(_amount);
        //Here we can get buffers,Add logics and change return values as per our business requirement.
        Return retAmount;
    }
}

Get buffers :

    FormRun formRun = this as  FormRun;

FormDataSource CustTable_DS =formRun.datasource(ForomDatasourceStr(CustTable,CustTable));

CustTable custTable = CustTable_DS.Cursor();

FormControl custAccount = formRun.design().ControlName(FormControlStr(FormName,ControlName));

Comments

Popular posts from this blog

SSRS Report using Controller , Contract and RDP classes in D365

Exporting data to Excel through X++ code

COC for Form level method

How to pass the parameter from one form to another in Dynamic365

Multi Select Lookup in SSRS Report in D365