Batch Job Log

Can anyone tell me if it’s possible to pull the text from a batch job log into a text file (or a variable) on the batch job grid via code? I’m specifically trying to pull it on specific logs that error, so I can email an admin the log with the errors.

Thanks!

Try this…

static void Job12(Args _args)

{

int i, countItems;

InfologData data;

BatchJobHistory BatchJobHistory;

;

select BatchJobHistory where BatchJobHistory.RecId==5637468836;

if (batchJobHistory && batchJobHistory.RecId)

{

data = BatchJobHistory::showLog(batchJobHistory.RecId);

countItems = conlen(data);

for(i=1;i<=countItems;i+=3)

{

print (info::infoCon2Str(conpeek(data, i+2)));

pause;

}

}

}

Also consider using alerts. Open the Batch job form, select a batch, press Alerts button, tick Error and E-mail and confirm.