How to debug in lightning using developer console API

By | March 17, 2021

A major part of any Salesforce developer’s job is debugging. Because Salesforce has a multitenant architecture, debugging on the platform is a bit different than it might be in other development environments. Commonly we use console.log() method to log on the console screen, but console provides wide range of methods which we helps to debugging efficiently. So in this blog we will see how to debug in lightning developer console using various methods.

  • Assert (): Assert needs no introduction. It accepts two arguments and if the first argument is false, it will display the message you put as the second argument.
var flag = false;
console.assert(flag, "Something is wrong");

Result: “Something is wrong” will be displayed on the console screen.

  • Clear (): Clears the console screen.
  • Error (): Logs error on the screen. It shows the message in the form of error.
console.error("Something wrong has happened");
Console Error
Console Error
  • Info (): It outputs an informational message to the console."Step 1 is missed");
Console Info
Console Info
  • Warn (): Just like the info method, it shows a warning message on console.
console.warn("Warning message");
Console warning
Console warning
  • Table (): It shows data in the console in a tabular format. It is useful when data is in arrays or objects.
var arr = [["Name", "Michael"], ["Designation", "SFDC Developer"], ["City", "Mumbai"]];
Console table
Console table
  • group () and groupEnd (): These two methods help in displaying messages in group. The current group ends when groupEnd () is called.
console.log("message without group");"Section1");
console.log("This message is in group Section1");
console.log ("This message is also in group Section1");
console.log ("Now again this message is without group");
Console Group
Console Group

We hope you may find this blog resourceful and helpful. If you still have concerns and need more help, please contact us at

About Us
Greytrix – a globally recognized and one of the oldest Sage Development Partner, as a Salesforce Product development partner offers a wide variety of integration products and services to the end users as well as to the Partners and Sage PSG across the globe. We offer Consultation, Configuration, Training and support services in out-of-the-box functionality as well as customizations to incorporate custom business rules and functionalities that require apex code incorporation into the Salesforce platform.

Greytrix has some unique solutions for Cloud CRM such as Salesforce Sage integration for Sage X3Sage 100 and Sage 300. We also offer best-in-class Cloud CRM Salesforce customization and development services along with services such as Salesforce Data MigrationIntegrated App developmentCustom App development and Technical Support to business partners and end users. Salesforce Cloud CRM integration offered by Greytrix works with Lightning web components and supports standard opportunity workflow.

Greytrix GUMU™ integration for Sage ERP – Salesforce is a 5-star rated app listed on Salesforce AppExchange.

For more information, please contact us at We will be glad to assist you.

Related Posts