Options

NAV 2017 Task Scheduler Codeunit 453 RemoveFailedJobs function is incorrect

PureHeartPureHeart Member Posts: 190
Hi All,

Just to let everyone know there is a bug in NAV 2017 in function RemoveFailedJobs...
The function deletes job queue entries in error for the same object ID without considering if the parameter string is the same or not... or if the run interval is the same...

JobQueueEntry2.SETRANGE("Object Type to Run",JobQueueEntry."Object Type to Run");
JobQueueEntry2.SETRANGE("Object ID to Run",JobQueueEntry."Object ID to Run");
JobQueueEntry2.SETRANGE("Record ID to Process",JobQueueEntry."Record ID to Process");
JobQueueEntry2.SETRANGE(Status,JobQueueEntry2.Status::Error);
IF NOT JobQueueEntry2.ISEMPTY THEN
JobQueueEntry2.DELETEALL;

Quick fix is to also filter for the parameter string but you could still end up with deleted setup entries if you setup a job queue entry for the same task at different times...

I'm actually questioning if this code should just be commented entirely... I don't think it is good practice to delete user setup entries...

What's your opin
Why don't you try my compare tool?
http://www.mibuso.com/dlinfo.asp?FileID=1123

Comments

  • Options
    PureHeartPureHeart Member Posts: 190
    I pressed enter before finishing.... I was going to say, What's your opinion on this bit of code?
    Why don't you try my compare tool?
    http://www.mibuso.com/dlinfo.asp?FileID=1123
  • Options
    Slawek_GuzekSlawek_Guzek Member Posts: 1,690
    edited 2017-09-04
    Hi,

    It depends how you look at it I guess. If you assume that you have just one specific job per one record instance then it looks OK. Filtering for a combination of an object and specific "Record ID" seems to be unique enough. As far as I know standard Cronus code does not insert any job queue entries with parameters, so I guess it is not an error from Microsoft point of view.

    Slawek
    Slawek Guzek
    Dynamics NAV, MS SQL Server, Wherescape RED;
    PRINCE2 Practitioner - License GR657010572SG
    GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
  • Options
    PureHeartPureHeart Member Posts: 190
    Well, leave a side the fact that Microsoft hasn't considered the parameters... they also haven't considered the fact I could have the same task running at different time of the day... and I don't think it's a good design deleting setup records the user has inserted...
    How would the user understand why his correct setup records are disappearing?
    Why don't you try my compare tool?
    http://www.mibuso.com/dlinfo.asp?FileID=1123
Sign In or Register to comment.