microsoft-dynamicsdynamics-navcal

Microsoft Dynamics NAV: Error Message Log


I'm still new to using Dynamics NAV and I'm still a junior Dev so I have a few questions:

I need to be able to Log error messages in NAV as they happen, I have the following fields in a table:

1 Entry No. Integer
2 Error Message Integer
3 Object ID Integer
4 Session ID Integer
5 User ID Integer
6 Object Name Text 250

It needs to log that information when an error occurs, I'm not really sure how to do it.


Solution

  • I'm not sure if you are trying to log errors in a specific object you are working on.

    Typically, I use

       String := GETLASTERRORTEXT
    

    in my custom code, when calling other Codeunits. This will give you the error description, which you can insert into your custom error log table.

    Here is the documentation:

    https://learn.microsoft.com/en-us/dynamics-nav/getlasterrortext-function