Hi, Readers.
Today I would like to share another mini tip about Business Central, how to view the last known error.
Both standard functionalities and custom extensions in Business Central will display error messages or stop processing when unexpected input occurs or system threshold limits are met. Clear, informative error messages help users understand what went wrong and how to correct it, reducing frustration, and improving user satisfaction. For example,
Field validation:

Posting routines:

Other code behind business functionality:

Did you know that even after closing an error dialog, you can inspect the last error via the Help & Support page?
Each company in any Business Central environment has a Help & Support page that can be accessed from the question mark in the top-right corner. Here you can access the latest error message, which, for example, is useful if your users complain of a confusing error message such as Sorry, we just updated this page. Please close and reopen.


The link behind the sentence View the last known error will find and show the most recent error message that was generated by the application code. This includes errors from field validation, posting routines, and other code behind business functionality.
The information that you can get from this link includes the following:
- Text: This is the error message that the user sees, either in a dialog window or next to a user interface element that can’t render, for example.
- Code: This is the code snippet that threw the error.
- Callstack: This shows how the error was triggered.
- Object: This shows information about the runtime objects.
Field validation:

Posting routines:

Other code behind business functionality:

Please note that if collectable errors are used, it is not possible to retrieve accurate error messages.
Normally, when an error occurs in a procedure, the procedure stops on the first error it meets. Using collectable errors essentially postpones error handling to the end of the procedure call. AL code execution doesn’t stop on errors. But instead, it continues until the end and gathers errors as they occur.


And the link can’t open errors that were generated by the platform. If you suspect that the issue is caused by the platform, try to reproduce the error in a sandbox environment before you contact Microsoft for support.
Great, give it a try!!!😁
PS:
1. You use the GetLastErrorCode method to identify the type of the last error that occurred. You use the GetLastErrorText Method to get the details of the last error.
The result of the GetLastErrorCode method is not translated into the local language. The result of the GetLastErrorText Method is translated into the local language. For example:

2. Business Central 2025 wave 2 (BC27): App version in “Copy error details”/”Share details via”
3. Business Central 2025 wave 1 (BC26): Get the current callstack (SessionInformation Data Type)
4. Business Central 2024 wave 1 (BC24): Easily copy Entra tenant ID, environment and session details
5. Business Central 2024 wave 1 (BC24): Share error details to get help from another user
END
Hope this will help.
Thanks for reading.
ZHU




コメント