Jigsaw Blog

27

Dec
2012
0 comments

NAV Job Queue says “In Process” but job has crashed

If the job encounters an error the Job Queue Entries page will continue to say the job is "In Process". In fact ist not and it will never run again until the job is reset.

If you are running NAV 2009SP1 or NAV2009R2 then apply the following code change to Code Unit 448 - Job Queue Dispactcher.

The change is made in the Handle Request trigger

Replace code

WasSuccess := CODEUNIT.RUN(CODEUNIT::"Job Queue Start Codeunit",JobQueueEntry);
IF WasSuccess THEN BEGIN
IF JobQueueEntry."Recurring Job" THEN BEGIN
JobQueueEntry."No. of Attempts to Run" := 0;
JobQueueEntry.Status := JobQueueEntry.Status::Ready;
IF NOT JobQueueEntry.MODIFY THEN
JobQueueEntry.INSERT;
END;
END
ELSE BEGIN
IF JobQueueEntry."Maximum No. of Attempts to Run" > JobQueueEntry."No. of Attempts to Run" THEN BEGIN
JobQueueEntry."No. of Attempts to Run" := JobQueueEntry."No. of Attempts to Run" + 1;
JobQueueEntry.Status := JobQueueEntry.Status::Ready;
IF NOT JobQueueEntry.INSERT THEN
JobQueueEntry.MODIFY;
END;
END;

With this code

WasSuccess := CODEUNIT.RUN(CODEUNIT::"Job Queue Start Codeunit",JobQueueEntry);
IF WasSuccess THEN BEGIN
IF JobQueueEntry."Recurring Job" THEN BEGIN
JobQueueEntry."No. of Attempts to Run" := 0;
JobQueueEntry.Status := JobQueueEntry.Status::Ready;
IF NOT JobQueueEntry.MODIFY THEN
JobQueueEntry.INSERT;
END;
END
ELSE BEGIN
IF JobQueueEntry."Maximum No. of Attempts to Run" > JobQueueEntry."No. of Attempts to Run" THEN BEGIN
JobQueueEntry."No. of Attempts to Run" := JobQueueEntry."No. of Attempts to Run" + 1;
JobQueueEntry.Status := JobQueueEntry.Status::Ready
// Add the following lines.
END
ELSE
JobQueueEntry.Status := JobQueueEntry.Status::Error;
// End of the added lines.
IF NOT JobQueueEntry.INSERT THEN
JobQueueEntry.MODIFY;
END;

It does not fix your error but at least the job will continue to run.

For more detail see:

http://support.microsoft.com/kb/2684834/en-US