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