How to capture errors in NAV?

chandrurec
Member Posts: 560
Hi All,
I am having one doubt . I am inserting some entries to Item. We know that Item No is code of 20 char and in case if I am inserting a item with more than 20 char then when I use GETLASTERRORTEXT function will it capture the error . I need to store the error when I am inserting the field in log table.
Since When it reads the lines
recitem.no = some text more than 20 char then nav will stop in this line so where can I place the function GETLASTERRORTEXT.
If anyone knows how to address this problem , kindly let me know.
Thanks in advance.
Regards,
chandru.
I am having one doubt . I am inserting some entries to Item. We know that Item No is code of 20 char and in case if I am inserting a item with more than 20 char then when I use GETLASTERRORTEXT function will it capture the error . I need to store the error when I am inserting the field in log table.
Since When it reads the lines
recitem.no = some text more than 20 char then nav will stop in this line so where can I place the function GETLASTERRORTEXT.
If anyone knows how to address this problem , kindly let me know.
Thanks in advance.
Regards,
chandru.
0
Comments
-
Hi Chandru,
To be honest i haven't checked this by trying, but I have always taken GETLASTERRORTEXTbeing the latest error thrown based on C/AL code execution (so based on ERROR, TESTFIELD, FIELDERROR).
In your case, where you would like to catch the error based on the entering of more chars than allowed, this error is a platform and as such not based on C/AL code. I do not think that GETLASTERRORTEXT will catch that.0 -
The only situation I am aware of, in which you can automatically log an error, is when you use Codeunit.RUN(Rec) (or CODEUNIT.RUN(No,Rec)) while consuming the return value of that function.0
-
Vaprog is correct. What you need to do is have the main code in a codeunit, then you need something like...
IF NOT mycodeunit.RUN() THEN BEGIN
Errorlog.init;
Errorlog."Entry No." := nextentryno;
Errorlog.text := GETLASTERRORTEXT;
Errorlog.INSERT;
END;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