SlideShare a Scribd company logo
Lightning Page
Optimization & Best
Practices
Hyderabad, Salesforce Community
@gauravforc
e
Gaurav Jain
HYD, IN Admin Group
Lead, Lightning
Champion,
Tech Lead at
CriticalRiver
@SF_HYD_UG @HydSfdg @HyderabadWit @hydmcug
@gauravforce @RoshanKotla @SwatiTaunk @pradeepsfdc99
#TrailblazerCommunity #TeenKaTadka #LightningChampions
#HyderabadSalesforceCommunity
Sanket Kumar
Lightning Champion,
System Engineer at TCS
@sanket539
• 10 Ways to Increase Lightning Page Performance
• Best Practise and Limits
• Measuring Page Load Time
• Error Handling Best Practices for Lightning and Apex
• Lightning Component Code Review using Command Line Interface (CLI)
• Q&A
• Trailheadathon Registration and Instruction
• Trailheadathon
Agenda
10 Ways to Increase Lightning Page Performance
• Excessive fields clutter your page layouts, make your implementation difficult to maintain,
and increase page load time.
• Details Tab on Record Pages as Secondary Tab
• Replacing Related Lists with the Related List Quick Links Component
• Using Related List – Single Component
• Less Number of Lightning Components on Record Lightning Pages
• Set Component Visibility
• Move some Lightning components to the Tabs or Accordion Lightning component
• Taking out Inline Visualforce Pages and Report Chart from Page Layout
• News and Twitter components should be placed behind a tab
• Disable Debug Mode
Best Practise and Limits
• The number of fields should not exceed more than 150 on a page layout.
• 0-50 – GREEN
• 51-150 – AMBER
• > 150 – RED
• Too many components on a page can cause it to load slowly. You should keep below in
mind:-
• 0-15 – GREEN
• 16-20 – AMBER
• > 20 – RED
DEMO
Error Handling Best Practices for Lightning and Apex
Client-server communication overview
1. A Lightning component sends a request to its Apex
controller using a server-side action.
2. The controller processes the request. This can
trigger a server-side error (permission issue, invalid
query).
3. The controller sends a response to the Lightning
component.
4. The Lightning component processes the response
in a callback function. This can trigger a client-side
error (unexpected response).
This pattern can trigger two types of errors that
developers must handle: server-side and client-side
errors.
• If you process a failing server request
as is, a system exception is returned to
the Lightning component.
• Doing so is bad practice as this results
in a generic error message: “An
internal server error has occurred” or
“Sorry to interrupt”. This is not user-
friendly and provides no information
about the error. We all hate that. 🙁
What to avoid
Server-side errors handling
Using AuraHandledException
Basic error handling
1. Wrap the code that can trigger
exceptions in a try-catch block
2. Throw an AuraHandledException in the
catch block. This allows you to provide a
custom user-friendly error message.
Custom error handling
1. Create a simple wrapper class that can
hold the data.
2. Instantiate your custom class, serialize it
as JSON, then pass it to the
AuraHandledException.
3. client-side (Lightning controller or
helper), parse the error message string
as JSON, and access your custom error
data.
The AuraHandledException is sent back to the client with your custom message, and you’re
free to display it in the way you want using the Lightning Component framework.
Client-side errors handling
Basic error handling
Just like Apex Exceptions, JavaScript Errors enable you
to separate result values from errors when you call a
function. For instance, if you follow best practices and
let your helper do the heavy-lifting, you can write code
like this in your controller
Custom error handling
If a text message is not enough data to describe your
error, you can extend the JavaScript standard Error
type and create errors with custom attributes.
try {
// Call a function that may throws an Error
let value = helper.doSomethingThatMightFails();
// Process value if function succeeded
} catch (e) {
// Handle error
console.error(e);
}
// Declaring a custom error type
function MyCustomError(name, message, code) {
this.name = name;
this.message = message;
this.code = code;
this.stack = (new Error()).stack;
}
MyCustomError.prototype = Object.create(Error.prototype);
MyCustomError.prototype.constructor = MyCustomError;
You now know how to handle those different errors and how
to extend them to fit your needs.
Before Error Handling
After Error
Handling
Step 1: Heroku Installation
Download the Heroku toolbelt on your machine from the following link:
https://toolbelt.heroku.com/
Step 2: Install Salesforce Lightning CLI
Install Lightning CLI as a Heroku Toolbelt plugin. Once this is done, update the Heroku
Toolbelt to get the latest Lightning CLI rules.
heroku plugins:install salesforce-lightning-cli
Lightning Component Code Review using Command Line
Interface (CLI)
Step 3: Use Salesforce Lightning CLI
To display the Code Review on the command prompt in a text format, use:
heroku lightning:lint "F:ANTMalwarebytesBackup Partial 2-2-
2020auraAVLR_TaxExcempt"
Lightning Component Code Review using Command Line
Interface (CLI)
Lightning page optimization & best practices

More Related Content

What's hot (20)

Will be an introduction to
Will be an introduction toWill be an introduction to
Will be an introduction to
Sayed Ahmed
 
2310 b 04
2310 b 042310 b 04
2310 b 04
Krazy Koder
 
Architecting single-page front-end apps
Architecting single-page front-end appsArchitecting single-page front-end apps
Architecting single-page front-end apps
Zohar Arad
 
Ajax Testing Approach
Ajax Testing ApproachAjax Testing Approach
Ajax Testing Approach
HarshJ
 
Ajax Testing Approach
Ajax Testing ApproachAjax Testing Approach
Ajax Testing Approach
HarshaVJoshi
 
WordPress and Client Side Web Applications WCTO
WordPress and Client Side Web Applications WCTOWordPress and Client Side Web Applications WCTO
WordPress and Client Side Web Applications WCTO
Roy Sivan
 
Five Ways to Scale your API Without Touching Your Code
Five Ways to Scale your API Without Touching Your CodeFive Ways to Scale your API Without Touching Your Code
Five Ways to Scale your API Without Touching Your Code
3scale
 
CiviCRM API v3
CiviCRM API v3CiviCRM API v3
CiviCRM API v3
Xavier dutoit
 
Wordcamp Toronto Presentation
Wordcamp Toronto PresentationWordcamp Toronto Presentation
Wordcamp Toronto Presentation
Roy Sivan
 
Build Your Own Instagram Filters
Build Your Own Instagram FiltersBuild Your Own Instagram Filters
Build Your Own Instagram Filters
TJ Stalcup
 
Salesforce asynchronous apex
Salesforce asynchronous apexSalesforce asynchronous apex
Salesforce asynchronous apex
Badan Singh Pundeer
 
Lizards & Pumpkins Catalog Replacement at mm17de
Lizards & Pumpkins Catalog Replacement at mm17deLizards & Pumpkins Catalog Replacement at mm17de
Lizards & Pumpkins Catalog Replacement at mm17de
vinaikopp
 
Keeping Things Simple In A Growing AngularJS App.
Keeping Things Simple In A Growing AngularJS App.Keeping Things Simple In A Growing AngularJS App.
Keeping Things Simple In A Growing AngularJS App.
Brandon Boswell, MBA
 
ASP.NET AJAX with Visual Studio 2008
ASP.NET AJAX with Visual Studio 2008ASP.NET AJAX with Visual Studio 2008
ASP.NET AJAX with Visual Studio 2008
Caleb Jenkins
 
Apex code Benchmarking
Apex code BenchmarkingApex code Benchmarking
Apex code Benchmarking
Amit Chaudhary
 
SPSDC 2013 Building Solutions using SharePoint Timer Jobs
SPSDC 2013 Building Solutions using SharePoint Timer JobsSPSDC 2013 Building Solutions using SharePoint Timer Jobs
SPSDC 2013 Building Solutions using SharePoint Timer Jobs
Prashant G Bhoyar (Microsoft MVP)
 
Overview on ring central errors: part 2
Overview on ring central errors: part 2Overview on ring central errors: part 2
Overview on ring central errors: part 2
Anirban Sen Chowdhary
 
Ajax & ASP.NET 2
Ajax & ASP.NET 2Ajax & ASP.NET 2
Ajax & ASP.NET 2
Talal Alsubaie
 
Introduction to ASP.NET MVC
Introduction to ASP.NET MVCIntroduction to ASP.NET MVC
Introduction to ASP.NET MVC
LearnNowOnline
 
SPSNJ 2013 Building Solutions using SharePoint TimerJobs
SPSNJ 2013 Building Solutions using SharePoint TimerJobsSPSNJ 2013 Building Solutions using SharePoint TimerJobs
SPSNJ 2013 Building Solutions using SharePoint TimerJobs
Prashant G Bhoyar (Microsoft MVP)
 
Will be an introduction to
Will be an introduction toWill be an introduction to
Will be an introduction to
Sayed Ahmed
 
Architecting single-page front-end apps
Architecting single-page front-end appsArchitecting single-page front-end apps
Architecting single-page front-end apps
Zohar Arad
 
Ajax Testing Approach
Ajax Testing ApproachAjax Testing Approach
Ajax Testing Approach
HarshJ
 
Ajax Testing Approach
Ajax Testing ApproachAjax Testing Approach
Ajax Testing Approach
HarshaVJoshi
 
WordPress and Client Side Web Applications WCTO
WordPress and Client Side Web Applications WCTOWordPress and Client Side Web Applications WCTO
WordPress and Client Side Web Applications WCTO
Roy Sivan
 
Five Ways to Scale your API Without Touching Your Code
Five Ways to Scale your API Without Touching Your CodeFive Ways to Scale your API Without Touching Your Code
Five Ways to Scale your API Without Touching Your Code
3scale
 
Wordcamp Toronto Presentation
Wordcamp Toronto PresentationWordcamp Toronto Presentation
Wordcamp Toronto Presentation
Roy Sivan
 
Build Your Own Instagram Filters
Build Your Own Instagram FiltersBuild Your Own Instagram Filters
Build Your Own Instagram Filters
TJ Stalcup
 
Lizards & Pumpkins Catalog Replacement at mm17de
Lizards & Pumpkins Catalog Replacement at mm17deLizards & Pumpkins Catalog Replacement at mm17de
Lizards & Pumpkins Catalog Replacement at mm17de
vinaikopp
 
Keeping Things Simple In A Growing AngularJS App.
Keeping Things Simple In A Growing AngularJS App.Keeping Things Simple In A Growing AngularJS App.
Keeping Things Simple In A Growing AngularJS App.
Brandon Boswell, MBA
 
ASP.NET AJAX with Visual Studio 2008
ASP.NET AJAX with Visual Studio 2008ASP.NET AJAX with Visual Studio 2008
ASP.NET AJAX with Visual Studio 2008
Caleb Jenkins
 
Apex code Benchmarking
Apex code BenchmarkingApex code Benchmarking
Apex code Benchmarking
Amit Chaudhary
 
Overview on ring central errors: part 2
Overview on ring central errors: part 2Overview on ring central errors: part 2
Overview on ring central errors: part 2
Anirban Sen Chowdhary
 
Introduction to ASP.NET MVC
Introduction to ASP.NET MVCIntroduction to ASP.NET MVC
Introduction to ASP.NET MVC
LearnNowOnline
 

Similar to Lightning page optimization & best practices (20)

London SF Developers: Custom Lightning Component Error Handling
London SF Developers: Custom Lightning Component Error HandlingLondon SF Developers: Custom Lightning Component Error Handling
London SF Developers: Custom Lightning Component Error Handling
Richard Clark
 
Presemtation Tier Optimizations
Presemtation Tier OptimizationsPresemtation Tier Optimizations
Presemtation Tier Optimizations
Anup Hariharan Nair
 
ASP.NET 05 - Exception Handling And Validation Controls
ASP.NET 05 - Exception Handling And Validation ControlsASP.NET 05 - Exception Handling And Validation Controls
ASP.NET 05 - Exception Handling And Validation Controls
Randy Connolly
 
Understanding progressive enhancement - yuiconf2010
Understanding progressive enhancement - yuiconf2010Understanding progressive enhancement - yuiconf2010
Understanding progressive enhancement - yuiconf2010
Christian Heilmann
 
Global Exception Handling Custom Error Connector In MuleSoft
Global Exception Handling Custom Error Connector In MuleSoftGlobal Exception Handling Custom Error Connector In MuleSoft
Global Exception Handling Custom Error Connector In MuleSoft
shyamraj55
 
Google App Engine for Java
Google App Engine for JavaGoogle App Engine for Java
Google App Engine for Java
Lars Vogel
 
Client Side Performance In Web Applications
Client Side Performance In Web ApplicationsClient Side Performance In Web Applications
Client Side Performance In Web Applications
vladungureanu
 
SCWCD : Handling exceptions : CHAP : 5
SCWCD : Handling exceptions : CHAP : 5SCWCD : Handling exceptions : CHAP : 5
SCWCD : Handling exceptions : CHAP : 5
Ben Abdallah Helmi
 
Top 5 React Performance Optimization Techniques in 2023
Top 5 React Performance Optimization Techniques in 2023Top 5 React Performance Optimization Techniques in 2023
Top 5 React Performance Optimization Techniques in 2023
ultroNeous Technologies | Best Web App Development Company
 
Php exceptions
Php exceptionsPhp exceptions
Php exceptions
Damian Sromek
 
Secure mvc application saineshwar
Secure mvc application   saineshwarSecure mvc application   saineshwar
Secure mvc application saineshwar
Saineshwar bageri
 
Developing Lightning Components for Communities.pptx
Developing Lightning Components for Communities.pptxDeveloping Lightning Components for Communities.pptx
Developing Lightning Components for Communities.pptx
Dmitry Vinnik
 
Developing Java Web Applications In Google App Engine
Developing Java Web Applications In Google App EngineDeveloping Java Web Applications In Google App Engine
Developing Java Web Applications In Google App Engine
Tahir Akram
 
Magento's Imagine eCommerce Conference: Do You Queue?
Magento's Imagine eCommerce Conference: Do You Queue?Magento's Imagine eCommerce Conference: Do You Queue?
Magento's Imagine eCommerce Conference: Do You Queue?
varien
 
Introduction to Magento Optimization
Introduction to Magento OptimizationIntroduction to Magento Optimization
Introduction to Magento Optimization
Fabio Daniele
 
Beginning AngularJS
Beginning AngularJSBeginning AngularJS
Beginning AngularJS
Troy Miles
 
Ajax Performance
Ajax PerformanceAjax Performance
Ajax Performance
kaven yan
 
20211202 North America DevOps Group NADOG Adapting to Covid With Serverless C...
20211202 North America DevOps Group NADOG Adapting to Covid With Serverless C...20211202 North America DevOps Group NADOG Adapting to Covid With Serverless C...
20211202 North America DevOps Group NADOG Adapting to Covid With Serverless C...
Craeg Strong
 
Server side programming bt0083
Server side programming bt0083Server side programming bt0083
Server side programming bt0083
Divyam Pateriya
 
The Basics Angular JS
The Basics Angular JS The Basics Angular JS
The Basics Angular JS
OrisysIndia
 
London SF Developers: Custom Lightning Component Error Handling
London SF Developers: Custom Lightning Component Error HandlingLondon SF Developers: Custom Lightning Component Error Handling
London SF Developers: Custom Lightning Component Error Handling
Richard Clark
 
ASP.NET 05 - Exception Handling And Validation Controls
ASP.NET 05 - Exception Handling And Validation ControlsASP.NET 05 - Exception Handling And Validation Controls
ASP.NET 05 - Exception Handling And Validation Controls
Randy Connolly
 
Understanding progressive enhancement - yuiconf2010
Understanding progressive enhancement - yuiconf2010Understanding progressive enhancement - yuiconf2010
Understanding progressive enhancement - yuiconf2010
Christian Heilmann
 
Global Exception Handling Custom Error Connector In MuleSoft
Global Exception Handling Custom Error Connector In MuleSoftGlobal Exception Handling Custom Error Connector In MuleSoft
Global Exception Handling Custom Error Connector In MuleSoft
shyamraj55
 
Google App Engine for Java
Google App Engine for JavaGoogle App Engine for Java
Google App Engine for Java
Lars Vogel
 
Client Side Performance In Web Applications
Client Side Performance In Web ApplicationsClient Side Performance In Web Applications
Client Side Performance In Web Applications
vladungureanu
 
SCWCD : Handling exceptions : CHAP : 5
SCWCD : Handling exceptions : CHAP : 5SCWCD : Handling exceptions : CHAP : 5
SCWCD : Handling exceptions : CHAP : 5
Ben Abdallah Helmi
 
Secure mvc application saineshwar
Secure mvc application   saineshwarSecure mvc application   saineshwar
Secure mvc application saineshwar
Saineshwar bageri
 
Developing Lightning Components for Communities.pptx
Developing Lightning Components for Communities.pptxDeveloping Lightning Components for Communities.pptx
Developing Lightning Components for Communities.pptx
Dmitry Vinnik
 
Developing Java Web Applications In Google App Engine
Developing Java Web Applications In Google App EngineDeveloping Java Web Applications In Google App Engine
Developing Java Web Applications In Google App Engine
Tahir Akram
 
Magento's Imagine eCommerce Conference: Do You Queue?
Magento's Imagine eCommerce Conference: Do You Queue?Magento's Imagine eCommerce Conference: Do You Queue?
Magento's Imagine eCommerce Conference: Do You Queue?
varien
 
Introduction to Magento Optimization
Introduction to Magento OptimizationIntroduction to Magento Optimization
Introduction to Magento Optimization
Fabio Daniele
 
Beginning AngularJS
Beginning AngularJSBeginning AngularJS
Beginning AngularJS
Troy Miles
 
Ajax Performance
Ajax PerformanceAjax Performance
Ajax Performance
kaven yan
 
20211202 North America DevOps Group NADOG Adapting to Covid With Serverless C...
20211202 North America DevOps Group NADOG Adapting to Covid With Serverless C...20211202 North America DevOps Group NADOG Adapting to Covid With Serverless C...
20211202 North America DevOps Group NADOG Adapting to Covid With Serverless C...
Craeg Strong
 
Server side programming bt0083
Server side programming bt0083Server side programming bt0083
Server side programming bt0083
Divyam Pateriya
 
The Basics Angular JS
The Basics Angular JS The Basics Angular JS
The Basics Angular JS
OrisysIndia
 

Recently uploaded (20)

ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes
 
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc
 
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath MaestroDev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
UiPathCommunity
 
Greenhouse_Monitoring_Presentation.pptx.
Greenhouse_Monitoring_Presentation.pptx.Greenhouse_Monitoring_Presentation.pptx.
Greenhouse_Monitoring_Presentation.pptx.
hpbmnnxrvb
 
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdfSAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
Precisely
 
Big Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur MorganBig Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur Morgan
Arthur Morgan
 
Rusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond SparkRusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond Spark
carlyakerly1
 
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul
 
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptxIncreasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Anoop Ashok
 
How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?
Daniel Lehner
 
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
organizerofv
 
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdfComplete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Software Company
 
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep DiveDesigning Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
ScyllaDB
 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
 
Technology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data AnalyticsTechnology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data Analytics
InData Labs
 
2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx
Samuele Fogagnolo
 
Procurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptxProcurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptx
Jon Hansen
 
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Impelsys Inc.
 
HCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser EnvironmentsHCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser Environments
panagenda
 
Mobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi ArabiaMobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi Arabia
Steve Jonas
 
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes
 
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc
 
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath MaestroDev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
UiPathCommunity
 
Greenhouse_Monitoring_Presentation.pptx.
Greenhouse_Monitoring_Presentation.pptx.Greenhouse_Monitoring_Presentation.pptx.
Greenhouse_Monitoring_Presentation.pptx.
hpbmnnxrvb
 
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdfSAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
Precisely
 
Big Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur MorganBig Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur Morgan
Arthur Morgan
 
Rusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond SparkRusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond Spark
carlyakerly1
 
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul
 
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptxIncreasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Anoop Ashok
 
How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?
Daniel Lehner
 
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
organizerofv
 
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdfComplete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Software Company
 
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep DiveDesigning Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
ScyllaDB
 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
 
Technology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data AnalyticsTechnology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data Analytics
InData Labs
 
2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx
Samuele Fogagnolo
 
Procurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptxProcurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptx
Jon Hansen
 
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Impelsys Inc.
 
HCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser EnvironmentsHCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser Environments
panagenda
 
Mobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi ArabiaMobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi Arabia
Steve Jonas
 

Lightning page optimization & best practices

  • 1. Lightning Page Optimization & Best Practices Hyderabad, Salesforce Community @gauravforc e Gaurav Jain HYD, IN Admin Group Lead, Lightning Champion, Tech Lead at CriticalRiver @SF_HYD_UG @HydSfdg @HyderabadWit @hydmcug @gauravforce @RoshanKotla @SwatiTaunk @pradeepsfdc99 #TrailblazerCommunity #TeenKaTadka #LightningChampions #HyderabadSalesforceCommunity Sanket Kumar Lightning Champion, System Engineer at TCS @sanket539
  • 2. • 10 Ways to Increase Lightning Page Performance • Best Practise and Limits • Measuring Page Load Time • Error Handling Best Practices for Lightning and Apex • Lightning Component Code Review using Command Line Interface (CLI) • Q&A • Trailheadathon Registration and Instruction • Trailheadathon Agenda
  • 3. 10 Ways to Increase Lightning Page Performance • Excessive fields clutter your page layouts, make your implementation difficult to maintain, and increase page load time. • Details Tab on Record Pages as Secondary Tab • Replacing Related Lists with the Related List Quick Links Component • Using Related List – Single Component • Less Number of Lightning Components on Record Lightning Pages • Set Component Visibility • Move some Lightning components to the Tabs or Accordion Lightning component • Taking out Inline Visualforce Pages and Report Chart from Page Layout • News and Twitter components should be placed behind a tab • Disable Debug Mode
  • 4. Best Practise and Limits • The number of fields should not exceed more than 150 on a page layout. • 0-50 – GREEN • 51-150 – AMBER • > 150 – RED • Too many components on a page can cause it to load slowly. You should keep below in mind:- • 0-15 – GREEN • 16-20 – AMBER • > 20 – RED
  • 6. Error Handling Best Practices for Lightning and Apex Client-server communication overview 1. A Lightning component sends a request to its Apex controller using a server-side action. 2. The controller processes the request. This can trigger a server-side error (permission issue, invalid query). 3. The controller sends a response to the Lightning component. 4. The Lightning component processes the response in a callback function. This can trigger a client-side error (unexpected response). This pattern can trigger two types of errors that developers must handle: server-side and client-side errors.
  • 7. • If you process a failing server request as is, a system exception is returned to the Lightning component. • Doing so is bad practice as this results in a generic error message: “An internal server error has occurred” or “Sorry to interrupt”. This is not user- friendly and provides no information about the error. We all hate that. 🙁 What to avoid
  • 8. Server-side errors handling Using AuraHandledException Basic error handling 1. Wrap the code that can trigger exceptions in a try-catch block 2. Throw an AuraHandledException in the catch block. This allows you to provide a custom user-friendly error message. Custom error handling 1. Create a simple wrapper class that can hold the data. 2. Instantiate your custom class, serialize it as JSON, then pass it to the AuraHandledException. 3. client-side (Lightning controller or helper), parse the error message string as JSON, and access your custom error data. The AuraHandledException is sent back to the client with your custom message, and you’re free to display it in the way you want using the Lightning Component framework.
  • 9. Client-side errors handling Basic error handling Just like Apex Exceptions, JavaScript Errors enable you to separate result values from errors when you call a function. For instance, if you follow best practices and let your helper do the heavy-lifting, you can write code like this in your controller Custom error handling If a text message is not enough data to describe your error, you can extend the JavaScript standard Error type and create errors with custom attributes. try { // Call a function that may throws an Error let value = helper.doSomethingThatMightFails(); // Process value if function succeeded } catch (e) { // Handle error console.error(e); } // Declaring a custom error type function MyCustomError(name, message, code) { this.name = name; this.message = message; this.code = code; this.stack = (new Error()).stack; } MyCustomError.prototype = Object.create(Error.prototype); MyCustomError.prototype.constructor = MyCustomError;
  • 10. You now know how to handle those different errors and how to extend them to fit your needs. Before Error Handling After Error Handling
  • 11. Step 1: Heroku Installation Download the Heroku toolbelt on your machine from the following link: https://toolbelt.heroku.com/ Step 2: Install Salesforce Lightning CLI Install Lightning CLI as a Heroku Toolbelt plugin. Once this is done, update the Heroku Toolbelt to get the latest Lightning CLI rules. heroku plugins:install salesforce-lightning-cli Lightning Component Code Review using Command Line Interface (CLI)
  • 12. Step 3: Use Salesforce Lightning CLI To display the Code Review on the command prompt in a text format, use: heroku lightning:lint "F:ANTMalwarebytesBackup Partial 2-2- 2020auraAVLR_TaxExcempt" Lightning Component Code Review using Command Line Interface (CLI)