Total Pageviews

18,969

Thursday, January 30, 2020

D365FO. Dynamics 365 fiance and operation. Get and update contract of batch job on Controller run method. ax 2012

set Batch id in contract if batch isInBatch check is true

in run method we will update the contract and set the batch id.


class BrFunctionalLocationRecordsController extends SysOperationServiceController
{
    protected void new()
    {
        super(classStr(BrFunctionalLocationRecordsService), methodStr(BrFunctionalLocationRecordsService, functionalLocationRecordsService), SysOperationExecutionMode::Synchronous);
    }

 
    public static BrFunctionalLocationRecordsController construct(SysOperationExecutionMode _executionMode = SysOperationExecutionMode::Synchronous)
    {
        BrFunctionalLocationRecordsController      controller;
        controller = new BrFunctionalLocationRecordsController();
        controller.parmExecutionMode(_executionMode);
        return controller;
    }

 
    public static void main(Args _args)
    {
        BrFunctionalLocationRecordsController controller;
        // to update contract value at main we can initialize contract here.
        //BrFunctionalLocationRecordsContract   brFunctionalLocationRecordsContract;

        controller = BrFunctionalLocationRecordsController::construct();
        //and can set contract values here
        //brFunctionalLocationRecordsContract = controller.getDataContractObject();
        controller.parmArgs(_args);
        controller.startOperation();
    }

 
    public ClassDescription defaultCaption()
    {
        return "@Br:FunctionalLocationRecords";
    }

   
    public void run()
    {
        BrFunctionalLocationRecordsContract brFunctionalLocationRecordsContract;

       //getting batch contract.
        brFunctionalLocationRecordsContract = this.getDataContractObject();
       
        Batch                                   batch;
        if (this.isInBatch())
        {
            //getting batch information;
            batch = this.currentBatch;
            //setting batch id in contract
            brFunctionalLocationRecordsContract.parmBatchHeader(batch.BatchJobId);
        }
        super();
    }

}

1 comment:

D365FO and Sharepoint integration issue on dev box: "You are not authorized to connect to 'https://sharepoint.sharepoint.com/

Troubleshooting SharePoint Integration After Upgrading D365FO to Version .42 After upgrading to Dynamics 365 Finance and Operations (D365FO)...