A batch job for AIF to export some data, it sets to run once daily, but sometimes it runs twice a day, after the first run, following by the second just a few minutes later.
The batch job exports item transactions status , it is a custom code. It runs every day in the morning! A few days ago, it ran twice in that morning in five minutes.
How you are saying that it ran twice? By looking at the batch job history or the does the data exported twice?
Look at the batch job history and its details, see if they are triggered by same batch job. (to check if someone hasn’t requested the data export by the running a different batch job). Also look at the AIF history.
There are two output files from AX, when i checked the batch history, the job only ran once. AIF history: there are the same messages twice showed. Noboby has touched this batch job.
It will help to reuse the queryRun object (multiple times). Example - If you have already looped through the records returned by the queryRun and again if you want to loop thorugh the same records for a different purpose, then you need to call reset. It takes the queryRun to the initial position so that you can traverse thourgh the records.
Try the below example in a job,
Query query;
QueryRun qr;
InventTable table;
query = new Query(‘InventTable’);
qr = new QueryRun(query);
while (qr.next())
{
table = qr.getNo(1);
info(table.ItemId);
}
info(‘Test’);
qr.reset(); //Try by removing and adding this line of code.
while (qr.next())
{
table = qr.getNo(1);
info(table.ItemId);
}