giovedì 5 gennaio 2017

HOWTO: Run a BATCH using x++ (Helps for debug batch's in a simple way)

On AX2012 batch run always over a CIL context.
For debugging a BATCH without attach Visual Studio to AOS instance you can run in this way:

1. Create the batch job and assing a batch group not managed by a batch server
2. Create this method on BatchRun class:

server static public void runJobStaticCodeIL(RecId batchId)
{
    container ret;
    XppILExecutePermission  xppILExecutePermission;
    ;

    xppILExecutePermission = new XppILExecutePermission();
    xppILExecutePermission.assert();

    ret = runClassMethodIL(classStr(BatchRun), staticMethodStr(BatchRun, runJobStaticCode), [batchId]);

    CodeAccessPermission::revertAssert();
}

3. On batch activity get the JOB ID
2. Run the follow script

static void batchRun(Args _args)
{
    Batch batch;
    ;
    select batch where batch.BatchJobId == 5637161890;
    BatchRun::runJobStaticCodeIL(batch.RecId);
}

Now you can debug it!

Nessun commento:

Posta un commento

AX 2012: The request was aborted: Could not create SSL/TLS secure channel

The error you're encountering, "The request was aborted: Could not create SSL/TLS secure channel," can occur due to various re...