Introduced in Business Central Wave 1 2025 releases, the SessionInformation.Callstack()
method is a powerful diagnostic tool that helps developers trace the current call stack within AL code. Whether you’re troubleshooting custom extensions, tracking errors, or building telemetry, this method can become your best friend.
What is the SessionInformation.Callstack() Method?
The SessionInformation.Callstack()
method is a built-in function in AL that returns a text string representing the current call stack of the Business Central server session. Think of the call stack as a chronological list of the functions and procedures that have been called to reach the current point in your code.
Each entry in the call stack typically includes:
Syntax
var
CallStackText: Text;
begin
CallStackText := SessionInformation.Callstack();
end;
Why is the Call Stack Important?
Understanding the call stack is crucial for several reasons:
You can combine this with
ErrorInfo
object (for AL error handling)SessionInformation.UserId()
or CompanyName()
for full diagnostic logs
var
CallStack: Text;
ErrorData: ErrorInfo;
begin
if not TryMyFunction() then begin
GetLastError(ErrorData);
LogToTable('Error: %1 - Stack: %2', ErrorData.Message, SessionInformation.Callstack());
end;
SessionInformation.Callstack()
is a small method with big potential. It’s the AL developer’s X-ray — revealing the path of execution in complex customizations or tangled logic.
Use it smartly, especially in:
Stay Tuned for more updates
Original Post https://ammolhsaallvi.blog/2025/04/08/sessioninformation-callstack-in-business-central/