Monday, 7 November 2016

Managing Different Perspectives of the Developer Console

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.

It states:

Colour
Actions
Before trigger
After Trigger
Validation Rule
Assignment Rule
Workflow Rule

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!



References :



Written by Kaajal Bhawale, Salesforce Developer at Eternus Solutions

4 comments:

  1. Really very informative and creative contents. These concept is a good way to enhance the knowledge.I like it and help me to development very well.Thank you for this brief explanation and very nice information.Well, got a good knowledge.
    Android training in chennai

    ReplyDelete
  2. After looking into a handful of the blog articles on your site, I really like your technique of writing a blog. I book marked it to my bookmark site list and will be checking back in the near future. Take a look at my website as well and let me know your opinion.
    Digital Marketing Training in Chennai
    Dot Net Training in Chennai
    Hadoop Training in Chennai

    ReplyDelete
  3. Excellent goods from you, man. I’ve understand your stuff previous to and you’re just too excellent. I actually like what you’ve acquired here, certainly like what you are stating and the way in which you say it. You make it enjoyable and you still take care of to keep it sensible. I can not wait to read far more from you. This is actually a tremendous site..
    Growth Hacking Training in Chennai
    Ethical Hacking Training in Chennai

    ReplyDelete
  4. It’s the best time to make some plans for the future and it is time to be happy. I’ve read this post and if I could I want to suggest you few interesting things or suggestions.You can write next articles referring to this article. I desire to read even more things about it..
    Storage space rental singapore
    Cheapest storage space singapore
    Van delivery service singapore

    ReplyDelete