fb-share
Contact Us menu-bars menu-close

Managing Different Perspectives of the Developer Console

avatar

Kaajal Bhawale

November 07, 2016

Being a rookie Salesforce.com developer, I often wondered if System.debug statements were the only way to find out where my superbly written code was breaking. Much to my dismay, I was often all at sea, trying to find out the actual cause of the issue only through execution debug logs provided and without actually editing the code. Wasn’t there a better way, I thought? That’s when I stumbled upon the inbuilt features of the developer console.

The developer console basically provides a convenient set of tools for efficiently tracking down logical issues. A perspective is a predefined arrangement of panels in the developer console log inspector. The developer console has a set of tools that enables the developers to track what exactly is happening down there in the hood. These tools are grouped together by default and presented to us in the form of a perspective.

To view all the default perspectives, simply click on debug ? Perspective Manager in the developer console.

Out of these predefined perspectives, one of the most helpful panel is the Execution Overview panel which is a part of Analysis perspective.

The Execution Overview panel consists of four tabs.

Save Order Tab

Let’s consider a case where you are new to a project and are unable to gauge the exact flow of execution. Alternatively, you might be familiar with the project but observing some weird changes. You might find that some fields or actions are affected only if the code is executing recursively but for some reasons you are unable to determine where and what is making the code run into recursion? Another possible scenario could be where you are unable to determine which validation rule or which workflow rules are fired or is it a custom workflow or validation that is causing an issue to occur?

For all such scenarios, the immediate solution could be to direct to the Save Order tab which is a part of Execution Overview panel.

The Save Order tab provides an overview of all the actions that are performed during a DML operation in a beautiful color-coded format. Not only is it color coded, but it also displays all the actions in a intuitive sequence diagram. You no longer need to scratch your head in determining whether the validation rule ran first or the trigger; the Save Order tab has got it all covered.

This tab follows a color code format for better and fast understanding for the end user.

Once you click on the validation rules, you are directed to the actual validation rule in the execution log panel where you are able to view its actual detail.

Executed Units Tab

As a part of the Salesforce development, we might have faced a few exceptional scenarios we are usually scared of, but which need to be tackled nonetheless; such as the CPU time limit exceeded exception or the Heap size Limit exceeded exception. There might have been cases where you were unable to figure out the total number of rows affected due to the DML action.

The Executed Units tab, which is a part of the Execution Overview panel, helps you find the answers to all these queries very easily.

It displays the system resources used by each item in the process. Additionally, there are various buttons:  Method, Queries, Workflows, callouts, DML, validations, triggers, Pages; at the bottom of the tab which can be used to filter out information by item type.

In the Execution Units tab, we have following columns:

#
Column
Description
1
What The what column includes the various operations known as process items that are executed in particular execution. The different process items that are included are as follows:

  • Method
  • Queries
  • Workflow
  • Callouts
  • DML
  • Validations
  • Triggers
  • Pages
2
Name For each of the process included above, it gives the name for it.  e.g. If “method” is included in the “what” column the name of the method that is executed is displayed in the name column accordingly.
3
Sum If the process is executed more than once then the sum of duration for that particular execution is calculated in milliseconds.
4
Avg The Avg column displays the average duration (in milliseconds) taken for the process to be executed. It is calculated based on the formula (Sum/Count).
5
Max If the particular process is called more than once, the maximum duration (in milliseconds) taken for execution among all those executed processes is included in max column. One of the use case where the information displayed in this column would help you, is to solve CPU time limit exceeded exception.
6
Min If the particular process is called more than once the minimum duration (in milliseconds) taken for execution among all those executed processes is included in min column.
7
Count Number of times a particular process was called during its execution.
8
Heap Amount of space the process took on the heap is specified in bytes. e.g. Heap size limit exceeded exception would be traced much faster by observing information listed in this column.
9
Query Type Type of query. Possible values are:

  • SOQL
  • SOSL
10
Sum rows Sum of all records changed during the execution of particular process.
11
Avg rows Average number of records changed during the execution of particular process.
12
Max rows Maximum number of records changed during the execution of particular process. For eg: The Max rows count would help you to solve SOQL Limit exceeded exception by determining the exact process which has caused the exception.
13
Min rows Minimum number of records changed during the execution of particular process.

So many tools in such a small window! Magic, thy name is Developer Console! Guess what, the fairy tale doesn’t end here; there are some more unsung features that prove to be a great boon to the developers.  But that is for another day, as I shall be covering them in my next blogs. Till then, let the magic of Developer Console make life a smooth ride for you!

Get updates. Sign up for our newsletter.

contact-bg

Let's explore how we can create WOW for you!