When you’re going through the execution context, you are able to see all the locals of this part of the code. In the Locals panel, you can find all the variables, their names, types, and values. This helps you to trace each change of the variable's value or other attributes on every step of the execution process, so you can determine, for instance, what causes the error or the fail. With all the variables and all the data about them, you are able to understand the work of your code in a deeper detail.
The Locals panel displays the variables that are defined in the local scope, which is generally the function or method that is currently being executed.
All the data is separated in three columns:
- Name — the name of the local variable. The variables are displayed as a tree. Click on the arrow to the left of the variable name to expand the view to show fields and properties. To collapse the list right-click on the depending variable and select Collapse Parent; or just click on the arrow near the parents local one more time.
- Value — the value that the variable has in the active scope. If the variable has the depending ones, its value is displayed as the name of the file, where it's placed. At the same time, the depending variable has exact values.
- Type — the type of the variable: a string, boolean, object, integer, etc.
NB: If you reached the Salesforce limits, the name of the variable may be cut. The same rule is also true for the values of variables.
In addition, the Locals panel includes also the properties with all the related data. Similar to the locals, the properties in the Locals panel may have different nesting levels. At the same time, here you can find the address value for the custom types of your Locals. If this value is specified, you will see it in the Locals panel in the Debug mode.
If you want to trace some variable or property, you can do this, using the Add Watch / Add Parallel Watch options from the context menu of a variable or property. You'll get the opened Watch panel, it is similar to the Locals panel.
In this section:
This also may be useful: