Extension of a Form Datasource - Chain of command- D365 F&O - X++ Code

Rumman Ansari   Software Engineer   2023-10-27   481 Share
☰ Table of Contents

Table of Content:


COC for Form Datasource



[ExtensionOf(formDatasourcestr(SalesTableListPage,SalesTable))]
final class TM_SalesTable_DataSource_Extension
{
    public int active()
    {
        int ret = next active();  
        SalesTable SalesTable_ds = this.cursor();
        if(SalesTable_ds.SalesStatus == SalesStatus::Invoiced)
        {
            this.formRun().design().controlName(formControlStr(SalesTableListPage,FormButtonControl1)).enabled(true);
        }
        else
        {
            this.formRun().design().controlName(formControlStr(SalesTableListPage,FormButtonControl1)).enabled(false);
        }

        return  ret;
    }
}