NAV 2017 Task Scheduler Codeunit 453 RemoveFailedJobs function is incorrect

PureHeart
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
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
http://www.mibuso.com/dlinfo.asp?FileID=1123
0
Comments
-
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=11230 -
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.
SlawekSlawek Guzek
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-030 -
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=11230
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions