X++ code to disable menuitembutton when salesstatus is invoiced in salesTablelistPage using active method using chain of command (coc)

[ExtensionOf(formDataSourceStr(SalesTableListPage,SalesTable))]

final class BASDisablePO_Extension

{

    public int active()

    {

        FormDataSource fds = this;

        SalesTable salesTable;

        int ret;


        ret = next active();


        salesTable = fds.formRun().dataSource(formDataSourceStr(SalesTable, SalesTable)).cursor();

 FormControl purch=this.formRun().design().controlName(formControlStr(SalesTableListPage,Createpurchaseorders)) as FormControl;


        if (SalesTable.SalesStatus==SalesStatus::Invoiced)

        {

            purch.enabled(false);

        }

        else

        {

            purch.enabled(true);

        }


        return ret;

    }


}

Comments

Popular posts from this blog

How to Create a wizard in x++ d365

how to post trade agreement journals automatically using x++ code

X++ code to CREATE AND POST A TRADE AGREEMENT IN MICROSOFT DYNAMICS 365 in D365 F & O