Fault Tolerance for Errors

Saint-Sage
Member Posts: 92
Hello all,
I am working as a developer and my company is using Nav 3.7 with a 3.1 database. We have something similar to Job Scheduler that we leave running constantly. It checks a table called Dispatch Control every 60 seconds for a job that it must perform. If it finds one, it runs a corresponding report or codeunit.
The problem is this. Occasionally a part will come in from the commerce portal that is not in Navision. If that happens, Navision throws an error and we have to restart navision, add the item, then restart the Dispatcher. The same thing happens if there is a printer that runs out of paper or gets a paper jam. The whole process stops, and navision sets quiet with an error message displayed and when everyone comes in in the morning, we have to re-run the entire process.
Job scheduler does something similar however, it spits out an error message and then marks the codeunit to re-run at a later time. I would like to do something similar as our current fault tolerance is not acceptable.
My question is this, is there any way that I can trap errors in navision, spit out a report and then remove the modal error box and continue processing, similar to the way Job Scheduler does it?
Thanks for any help or comments you can give, even if it's not a solution.
I am working as a developer and my company is using Nav 3.7 with a 3.1 database. We have something similar to Job Scheduler that we leave running constantly. It checks a table called Dispatch Control every 60 seconds for a job that it must perform. If it finds one, it runs a corresponding report or codeunit.
The problem is this. Occasionally a part will come in from the commerce portal that is not in Navision. If that happens, Navision throws an error and we have to restart navision, add the item, then restart the Dispatcher. The same thing happens if there is a printer that runs out of paper or gets a paper jam. The whole process stops, and navision sets quiet with an error message displayed and when everyone comes in in the morning, we have to re-run the entire process.
Job scheduler does something similar however, it spits out an error message and then marks the codeunit to re-run at a later time. I would like to do something similar as our current fault tolerance is not acceptable.
My question is this, is there any way that I can trap errors in navision, spit out a report and then remove the modal error box and continue processing, similar to the way Job Scheduler does it?
Thanks for any help or comments you can give, even if it's not a solution.
No one loves you like the one who created you...
0
Comments
-
One way you can go about it is to update your process to do error checking first.
If an error occurs during checking, have the record be inserted into another table, then delete the record so the process won't stop.
After that, the user just need to go to the new table with problem records and address them one by one.
Basically, something like:IF NOT Item.GET(ItemNo) THEN BEGIN TableA.TRANSFERFIELDS(TableB); TableA.INSERT; TableB.DELETE; END;
Confessions of a Dynamics NAV Consultant = my blog
AP Commerce, Inc. = where I work
Getting Started with Dynamics NAV 2013 Application Development = my book
Implementing Microsoft Dynamics NAV - 3rd Edition = my 2nd book0 -
Thanks for the tip brokenlizard, I was working on something similar but your code is more straightforward. That will solve the problem with placing orders for which there is no item and that is one of our major hitches. I would like to still be able to set up some type of system so that the Dispatcher will still run regardless if it runs into an error. Sometimes there are errors like the printer running out of paper etc. Regardless of how often we tell the client to make sure that stuff is taken care of it winds up happening due to user error.
The structure is this...
Form Dispatcher has timer on 60 seconds....
->
Reads Table Dispatch Control and if it finds
a line that has a time/date stamp later than
current then execute that report/codeunit/dataport.
->
Writes to a Table Dispatch Log before and after
codeunit/report/dataport runs.
If it runs into an error in any of these, it breaks.
There are roughly 20 units called by dispatcher and each unit is several hundred lines of code. I could check all the states of data called in the codeunit before calling the codeunit, but that would be an arduous task to write, and it wouldn't stop things like printer errors.
Basically I need the ability to do a :
Try
Run Codeunit
Catch
Write to Error Log
Reset Dispatch Control Table entry for next run date/time
End Catch
Run Next Codeunit...
But I don't think there is a try/catch in navision?
Thanks for any help anyone can give...
No one loves you like the one who created you...0 -
After the error log is written, why not run a report based on the error log table?
What we did for a client was to run the error log form after the process is complete. But instead of a form, you can use a report.Confessions of a Dynamics NAV Consultant = my blog
AP Commerce, Inc. = where I work
Getting Started with Dynamics NAV 2013 Application Development = my book
Implementing Microsoft Dynamics NAV - 3rd Edition = my 2nd book0 -
Ok, I may have found the fix in the Tips+Tricks Section of Mibuso.
If CODEUNIT.RUN() THEN BEGIN
END ELSE BEGIN
END;
Should work. My problem was not processing an error log, but getting an error log to print when any kind of error occured within a codeunit/report/dataport without the system just hanging on the error.
I will update the post when I have it implemented and working, otherwise I will write a ranting post after two days of it not working
Thanks again for the help BL.
No one loves you like the one who created you...0 -
Curious about the Printer out of paper part. Wouldn't it just sit in the printers Queue until the printer problem was resolved? or do you have it set up differently Cause I don't understand why no paper would stop an import.0
-
Make sure you put COMMIT in the correct place in your code.0
-
ara3n, thanks for the tip, I checked for what you were talking about and commiting the data before I call each sucessive codeunit can help me provide a more efficient system. Have a great day!
No one loves you like the one who created you...0 -
It's recommend to commit after the Codeunit has run successfully.0
-
Take a look at report 297, it does basically what you are after.David Singleton0
-
Thanks for the help everyone, it looks like the solution is going to work well. I will post the specifics of the solution once it's finished. Everyone have a great day!
No one loves you like the one who created you...0
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