COC for form level

 1. canClose() :- 

[ExtensionOf(formStr(SalesTable))]

final class BAS_CanClose_Extension

{

    public boolean canClose()

    {

        boolean ret= next canClose();


        SalesTable CurrentSalesTable = this.args().record();


        if(ret)

        {

            SalesLine sl;

            select count(RecId) from sl

                where sl.SalesId==CurrentSalesTable.SalesId;

            if(sl.RecId>=5)

            {

                ret=checkFailed(strFmt("Salesorder %1 contain %2 lines",CurrentSalesTable.SalesId,sl.SalesId));

            }

        }

        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