Search code examples
batch-processingaxaptax++dynamics-ax-2012

How to force Batch mode executing in any case for Batch class?


I need to force in any case the Batch mode processing for my custom class extends RunBaseBatch by code. The user can't change the execution mode.

The shedule mode must only to be in Batch.

ForceBatchMode

I try to use in main method, before promt command these code line:

className.mustGoBatch();
className.parmInBatch(true);
className.doBatch();

BUT not work, I see the flag Batch processing switch off.

Thanks


Solution

  • use className.batchInfo().parmBatchExecute(NoYes::Yes);

    see Tutorial_RunbaseBatch class for example:

    static void main(Args args)
    {
        Tutorial_RunbaseBatch    tutorial_RunBase;
    ;
        tutorial_RunBase = Tutorial_RunbaseBatch::construct();
    
        // add this parm to switch on a batch processing
        tutorial_RunBase.batchInfo().parmBatchExecute(NoYes::Yes);
    
        if (tutorial_RunBase.prompt())
            tutorial_RunBase.run();
    }