Wednesday, August 10, 2022

Confirmation of sales agreement by code in Dynamics 365 FO

class SalesAgreementConfirm

{

    public static void run()

    {

        SalesAgreementHeader    SalesAgreementHeader;

        AgreementConfirm_Sales  objAgreementConfirm_Sales;

        SalesAgreementHeader.clear();

        SalesAgreementHeader  = SalesAgreementHeader::findAgreementId('SAG-000002');

        objAgreementConfirm_Sales = AgreementConfirm_Sales::construct();

        objAgreementConfirm_Sales.parmAgreementHeader(SalesAgreementHeader);

        //objAgreementConfirm_Sales.prompt(); //if you want prompt for user

        objAgreementConfirm_Sales.startConfirm(); //if you want silent confirmation without prompt

        info("Confirmed");

    }

}