When we work on creating Lighnting Components, for sure there will be a situation where we might be interested in debugging the code.
The usual route we take is using
console.log() method. While this approach works like a charm, it’s not effective when it comes to debugging the result-set which is basically a huge list of either Salesforce SObject or Custom Object records.
Reason being — response rendered in JSON format.
console.log() does is it logs the JSON response in the console panel of the browser. In case of a result-set which has a huge JSON response understanding it or analysing it becomes confusing with
In such cases we prefer to dump the response on lightning component between
<aura:iterate /> tag and try to get a hang of the result set.
Doesn't it make our lives lot more happier if the result-set is rendered in a tabular format like this ...
console.table(). All it does is — it takes the JSON response and renders the output in a nice tabular format in the console window.
This is how we can use it in the callback function.
I will be publishing a series of articles on such nice little tricks that we can use to speed up the development. Stay Tuned !!
You can find the web series here Salesforce Platform & Lightning Training with more than 150+ videos.
What's coming next?
Am working on Apex Triggers Series - please subscribe to get notified.