Personalized Community is here!
Quickly customize your community to find the content you seek.
Check out the latest Business Central updates!Learn about the key capabilities and features of Dynamics 365 Business Central and experience some of the new features.
Overview | Guided Tour | Free Trial
2023 Release Wave 1Check out the latest updates and new features of Dynamics 365 released from April 2023 through September 2023
The FastTrack program is designed to help you accelerate your Dynamics 365 deployment with confidence.
FastTrack Community | FastTrack Program | Finance and Operations TechTalks | Customer Engagement TechTalks | Upcoming TechTalks | All TechTalks
codeunit 50104 "Get Callstack"
SingleInstance = true;
procedure GetCallstack() Callstack: Text
LF := 10;
Callstack := GetCollectedErrors(true).Get(1).Callstack;
exit(Callstack.Substring(Callstack.IndexOf(Format(LF)) + 1));
I dunno, I was just curious whether it was possible. And, it is Any sensible applications are probably going to be do with error handling or reporting.
You may be tempted to have your code respond differently depending on the context in which it has been called and read the callstack for that purpose. That’s not a train you want to ride though. I’ve tried, it stops at some pretty weird stations.
One advantage of this approach over using a TryFunction (as below) is that the debugger doesn’t break on collectible errors. It can sometimes be frustrating stepping through errors that are always caught to get to the code that you actually want to debug.
procedure LessGoodGetCallstack(): Text
Business Applications communities