This recipe will show you how to use the debugger to examine the code that is currently executing. We will demonstrate how to go through the code line-by-line and watch how values and objects change.
First create a new codeunit from Object Designer.
Then add the following global variable:
Name
Type
Subtype
Customer
Record
Customer
We need to add the following global text constant as well:
Name
ConstValue
Text001
Rakesh Raul
Add a global function called
ChangeCustomerName
.The previous function should take the following parameter:
Name
Type
Length
NewName
Text
50
Add the following code to the function:
Customer.Name := NewName;
Add the following code to the
OnRun
trigger:Customer.FINDFIRST; ChangeCustomerName(Text001); Customer.VALIDATE("Post Code");
Save and close the codeunit.
Now from the Tools menu in the NAV client, go to Debugger | Debug Session (Shift + Ctrl + F11).
You should see the currently running session list:
To debug the...