SlideShare a Scribd company logo
Best Practices with
Apex in 2022
LOGO
Lead Developer Advocate
@msrivastav13
Mohith Shrivastava
LOGO
Lead Developer Advocate
@codefriar
Kevin Poorman
Automates complex business processes
Multi-tenant aware, easy to test, versioned
Apex lets us extends platform capabilities
Most sought out skill if you are looking to be a
Salesforce Developer
What’s special about Apex?
100s
of
billions
Yearly
Transactions
We have divided best practices of Apex
into following categories
❏ Security
❏ Performance
❏ Designing For Scale
❏ Reusability
❏ Maintainability
Building Enterprise Apps with Apex
https://sfdc.co/apex-recipes
Apex Recipes
Scan the above QR Code to
navigate to apex-recipes git repo
Security
Improve App Security by Enforcing
CRUD/FLS
// check for create permission (CRUD Example)
CanTheUser.create(new Account());
CanTheUser.read(listcontacts);
// check for FLS permission
CanTheUser.flsAccessible(‘Opportunity’, ‘Amount’);
CanTheUser.flsUpdatable(‘Opportunity’, ‘Amount’);
// check for FLS permission when querying
new Safely.doQuery(query string);
Scan the above QR Code to
navigate to Security Recipes
Strengthen your Data Security
Comply with privacy policies and regulatory
requirements
● encrypting data at rest - Use Shield Platform
encryption
● encrypt data transmitted over network - Encryption
recipes
// An Example from Encryption Recipes
String toHash = ‘Test Data’;
Blob dataToHash = Blob.valueof(toHash);
Blob hash = EncryptionRecipes.generateSHA512HashRecipe(dataToHash);
EncryptionRecipes.checkSHA512HashRecipe(hash, dataToHash);
Scan the above QR Code to
navigate to Encryption
Recipes
Integration Best Practices in Apex
● Use Named Credential
○ Avoid storing username and passwords or API
keys if possible
● Understand limits of Apex
○ Apex might not be ideal for every type of
integration
Scan the above QR Code to
navigate to Integration
Apex Recipes
Performance
Improve speed using Platform Cache
Platform cache provides memory layer to store
session and org data for later reuse.
Some use case for platform cache below
● static data
● reused throughout the session/user requests
● expensive to compute or retrieve
// An Example from Platform cache recipe
// Store in org cache
PlatformCacheRecipes.storeValueInOrgCache(‘Account’, ‘Test Account
static data’);
// Store from org cache
PlatformCacheRecipes.getDefaultPartition(PlatformCacheRecipes.PartitionT
ype.ORG).get(‘Account’);
Scan the above QR Code
to navigate to Platform
Cache Recipes
Design for Scale
Code Bulkification & Optimization
● No DML or SOQL inside FOR loops
● Understand Apex governor limits
● Write optimized queries
● Design Code modules that can process collections
of records in a single transaction
Scan the above QR Code
to navigate to Collection
Recipes
Solve for Large Data Volumes(LDV)
Process large chunks of data using Queueables.
● You can find an example of how to process large
dataset in serial using queueables in apex recipes
● Design your queuables to be fail proof using
Transaction Finalizers
Honorable mention to functions. Functions are
great way to handle LDV use cases
Scan the above QR Code
to navigate to LDV
Recipes
Reusability
Reusability
● Adopt a trigger framework when writing triggers
with one trigger per object
● Apex-Recipes provides an opinionated
framework
■ Uses CMDT to control the order of execution
■ A bypass flag to switch off the trigger when
needed
Scan the above QR Code
to navigate to Trigger
Recipes
Maintainability
Coding Conventions and Standards
● Define and follow a uniform naming conventions
● Avoid hardcoding IDs
● Error Logging Frameworks
○ Fire platform events upon errors
● Use PMD to Scan your apex
● Implement CI & CD for the project to discover
breaking changes
Scan the above QR Code to
navigate to Success Cloud Coding
Conventions Trailhead Module
Write meaningful tests
● Use test data factories to create and manage
reusable data for testing needs
● Use Mocks for testing API callouts
● Use Stub provider to build mocking frameworks
for unit testing
● Write meaningful negative tests
Scan the above QR Code
to navigate to Testing
Recipes
RAD Women needs your help!
radwomen.org/be-a-part-
of-radwomen/
@radwomencode
Thank You

More Related Content

What's hot

Development Best Practices
Development Best PracticesDevelopment Best Practices
Development Best Practices
Salesforce Partners
 
Integrating with salesforce
Integrating with salesforceIntegrating with salesforce
Integrating with salesforce
Mark Adcock
 
Deep Dive into Apex Triggers
Deep Dive into Apex TriggersDeep Dive into Apex Triggers
Deep Dive into Apex Triggers
Salesforce Developers
 
LWC Episode 3- Component Communication and Aura Interoperability
LWC Episode 3- Component Communication and Aura InteroperabilityLWC Episode 3- Component Communication and Aura Interoperability
LWC Episode 3- Component Communication and Aura Interoperability
Salesforce Developers
 
A comprehensive guide to Salesforce Org Strategy
A comprehensive guide to Salesforce Org StrategyA comprehensive guide to Salesforce Org Strategy
A comprehensive guide to Salesforce Org Strategy
Gaytri khandelwal
 
How to Use Salesforce Platform Events to Help With Salesforce Limits
How to Use Salesforce Platform Events to Help With Salesforce LimitsHow to Use Salesforce Platform Events to Help With Salesforce Limits
How to Use Salesforce Platform Events to Help With Salesforce Limits
Roy Gilad
 
Real Time Integration with Salesforce Platform Events
Real Time Integration with Salesforce Platform EventsReal Time Integration with Salesforce Platform Events
Real Time Integration with Salesforce Platform Events
Salesforce Developers
 
Tackling Salesforce Technical Debt
Tackling Salesforce Technical DebtTackling Salesforce Technical Debt
Tackling Salesforce Technical Debt
panayaofficial
 
Manage Development in Your Org with Salesforce Governance Framework
Manage Development in Your Org with Salesforce Governance FrameworkManage Development in Your Org with Salesforce Governance Framework
Manage Development in Your Org with Salesforce Governance Framework
Salesforce Developers
 
Salesforce integration best practices columbus meetup
Salesforce integration best practices   columbus meetupSalesforce integration best practices   columbus meetup
Salesforce integration best practices columbus meetup
MuleSoft Meetup
 
Discover salesforce, dev ops and Copado CI/CD automations
Discover salesforce, dev ops and Copado CI/CD automationsDiscover salesforce, dev ops and Copado CI/CD automations
Discover salesforce, dev ops and Copado CI/CD automations
JackGuo20
 
Episode 20 - Trigger Frameworks in Salesforce
Episode 20 - Trigger Frameworks in SalesforceEpisode 20 - Trigger Frameworks in Salesforce
Episode 20 - Trigger Frameworks in Salesforce
Jitendra Zaa
 
Apex trigger framework Salesforce #ApexTrigger #Salesforce #SFDCPanther
Apex trigger framework Salesforce #ApexTrigger #Salesforce #SFDCPantherApex trigger framework Salesforce #ApexTrigger #Salesforce #SFDCPanther
Apex trigger framework Salesforce #ApexTrigger #Salesforce #SFDCPanther
Amit Singh
 
Planning Your Migration to the Lightning Experience
Planning Your Migration to the Lightning ExperiencePlanning Your Migration to the Lightning Experience
Planning Your Migration to the Lightning Experience
Shell Black
 
Introduction to Apex for Developers
Introduction to Apex for DevelopersIntroduction to Apex for Developers
Introduction to Apex for Developers
Salesforce Developers
 
Exploring the Salesforce REST API
Exploring the Salesforce REST APIExploring the Salesforce REST API
Exploring the Salesforce REST API
Salesforce Developers
 
Salesforce Integration Patterns
Salesforce Integration PatternsSalesforce Integration Patterns
Salesforce Integration Patterns
usolutions
 
Batch Apex in Salesforce
Batch Apex in SalesforceBatch Apex in Salesforce
Batch Apex in Salesforce
David Helgerson
 
LMS Lightning Message Service
LMS Lightning Message ServiceLMS Lightning Message Service
LMS Lightning Message Service
Peter Chittum
 

What's hot (20)

Development Best Practices
Development Best PracticesDevelopment Best Practices
Development Best Practices
 
Integrating with salesforce
Integrating with salesforceIntegrating with salesforce
Integrating with salesforce
 
Deep Dive into Apex Triggers
Deep Dive into Apex TriggersDeep Dive into Apex Triggers
Deep Dive into Apex Triggers
 
LWC Episode 3- Component Communication and Aura Interoperability
LWC Episode 3- Component Communication and Aura InteroperabilityLWC Episode 3- Component Communication and Aura Interoperability
LWC Episode 3- Component Communication and Aura Interoperability
 
A comprehensive guide to Salesforce Org Strategy
A comprehensive guide to Salesforce Org StrategyA comprehensive guide to Salesforce Org Strategy
A comprehensive guide to Salesforce Org Strategy
 
How to Use Salesforce Platform Events to Help With Salesforce Limits
How to Use Salesforce Platform Events to Help With Salesforce LimitsHow to Use Salesforce Platform Events to Help With Salesforce Limits
How to Use Salesforce Platform Events to Help With Salesforce Limits
 
Real Time Integration with Salesforce Platform Events
Real Time Integration with Salesforce Platform EventsReal Time Integration with Salesforce Platform Events
Real Time Integration with Salesforce Platform Events
 
Tackling Salesforce Technical Debt
Tackling Salesforce Technical DebtTackling Salesforce Technical Debt
Tackling Salesforce Technical Debt
 
Manage Development in Your Org with Salesforce Governance Framework
Manage Development in Your Org with Salesforce Governance FrameworkManage Development in Your Org with Salesforce Governance Framework
Manage Development in Your Org with Salesforce Governance Framework
 
Salesforce integration best practices columbus meetup
Salesforce integration best practices   columbus meetupSalesforce integration best practices   columbus meetup
Salesforce integration best practices columbus meetup
 
Discover salesforce, dev ops and Copado CI/CD automations
Discover salesforce, dev ops and Copado CI/CD automationsDiscover salesforce, dev ops and Copado CI/CD automations
Discover salesforce, dev ops and Copado CI/CD automations
 
Episode 20 - Trigger Frameworks in Salesforce
Episode 20 - Trigger Frameworks in SalesforceEpisode 20 - Trigger Frameworks in Salesforce
Episode 20 - Trigger Frameworks in Salesforce
 
Apex trigger framework Salesforce #ApexTrigger #Salesforce #SFDCPanther
Apex trigger framework Salesforce #ApexTrigger #Salesforce #SFDCPantherApex trigger framework Salesforce #ApexTrigger #Salesforce #SFDCPanther
Apex trigger framework Salesforce #ApexTrigger #Salesforce #SFDCPanther
 
Planning Your Migration to the Lightning Experience
Planning Your Migration to the Lightning ExperiencePlanning Your Migration to the Lightning Experience
Planning Your Migration to the Lightning Experience
 
Introduction to Apex for Developers
Introduction to Apex for DevelopersIntroduction to Apex for Developers
Introduction to Apex for Developers
 
Exploring the Salesforce REST API
Exploring the Salesforce REST APIExploring the Salesforce REST API
Exploring the Salesforce REST API
 
Salesforce Integration Patterns
Salesforce Integration PatternsSalesforce Integration Patterns
Salesforce Integration Patterns
 
Batch Apex in Salesforce
Batch Apex in SalesforceBatch Apex in Salesforce
Batch Apex in Salesforce
 
Governor limits
Governor limitsGovernor limits
Governor limits
 
LMS Lightning Message Service
LMS Lightning Message ServiceLMS Lightning Message Service
LMS Lightning Message Service
 

Similar to Best Practices with Apex in 2022.pdf

Compliance as Code Everywhere
Compliance as Code EverywhereCompliance as Code Everywhere
Compliance as Code Everywhere
Matt Ray
 
Cluster-as-code. The Many Ways towards Kubernetes
Cluster-as-code. The Many Ways towards KubernetesCluster-as-code. The Many Ways towards Kubernetes
Cluster-as-code. The Many Ways towards Kubernetes
QAware GmbH
 
Application Modernisation with PKS
Application Modernisation with PKSApplication Modernisation with PKS
Application Modernisation with PKS
Phil Reay
 
Application Modernisation with PKS
Application Modernisation with PKSApplication Modernisation with PKS
Application Modernisation with PKS
Phil Reay
 
Salesforce Multitenant Architecture: How We Do the Magic We Do
Salesforce Multitenant Architecture: How We Do the Magic We DoSalesforce Multitenant Architecture: How We Do the Magic We Do
Salesforce Multitenant Architecture: How We Do the Magic We Do
Salesforce Developers
 
RightScale Roadtrip - Accelerate to Cloud
RightScale Roadtrip - Accelerate to CloudRightScale Roadtrip - Accelerate to Cloud
RightScale Roadtrip - Accelerate to Cloud
RightScale
 
Oracle Blockchain Platform_Wonjo Yoo
Oracle Blockchain Platform_Wonjo YooOracle Blockchain Platform_Wonjo Yoo
Oracle Blockchain Platform_Wonjo Yoo
Oracle Korea
 
How To Build Kubernetes Policies To Ensure Compliance for Databases.pptx
How To Build Kubernetes Policies To Ensure Compliance for Databases.pptxHow To Build Kubernetes Policies To Ensure Compliance for Databases.pptx
How To Build Kubernetes Policies To Ensure Compliance for Databases.pptx
LibbySchulze
 
DevOps LA Meetup Intro to Habitat
DevOps LA Meetup Intro to HabitatDevOps LA Meetup Intro to Habitat
DevOps LA Meetup Intro to Habitat
Jessica DeVita
 
Dot NET Solution Architect Roadmap By Scholarhat PDF
Dot NET Solution Architect Roadmap By Scholarhat PDFDot NET Solution Architect Roadmap By Scholarhat PDF
Dot NET Solution Architect Roadmap By Scholarhat PDF
Scholarhat
 
Cloud Native Applications on OpenShift
Cloud Native Applications on OpenShiftCloud Native Applications on OpenShift
Cloud Native Applications on OpenShift
Serhat Dirik
 
AWS Sydney Summit 2013 - Continuous Deployment Practices, with Production, Te...
AWS Sydney Summit 2013 - Continuous Deployment Practices, with Production, Te...AWS Sydney Summit 2013 - Continuous Deployment Practices, with Production, Te...
AWS Sydney Summit 2013 - Continuous Deployment Practices, with Production, Te...
Amazon Web Services
 
What are DevOps Application Patterns on AWS…and why do I need them?
What are DevOps Application Patterns on AWS…and why do I need them?What are DevOps Application Patterns on AWS…and why do I need them?
What are DevOps Application Patterns on AWS…and why do I need them?
DevOps.com
 
Architecting extremelylarge scale web applications
Architecting extremelylarge scale web applicationsArchitecting extremelylarge scale web applications
Architecting extremelylarge scale web applications
Prashanth Panduranga
 
Modernizing Testing as Apps Re-Architect
Modernizing Testing as Apps Re-ArchitectModernizing Testing as Apps Re-Architect
Modernizing Testing as Apps Re-Architect
DevOps.com
 
Using Apache as an Application Server
Using Apache as an Application ServerUsing Apache as an Application Server
Using Apache as an Application ServerPhil Windley
 
Patterns & Practices of Microservices
Patterns & Practices of MicroservicesPatterns & Practices of Microservices
Patterns & Practices of Microservices
Wesley Reisz
 
Value Stream Delivery Platform for ALM, DevOps DevSecOps and Cloud-based SaaS...
Value Stream Delivery Platform for ALM, DevOps DevSecOps and Cloud-based SaaS...Value Stream Delivery Platform for ALM, DevOps DevSecOps and Cloud-based SaaS...
Value Stream Delivery Platform for ALM, DevOps DevSecOps and Cloud-based SaaS...
Kovair
 

Similar to Best Practices with Apex in 2022.pdf (20)

Compliance as Code Everywhere
Compliance as Code EverywhereCompliance as Code Everywhere
Compliance as Code Everywhere
 
Cluster-as-code. The Many Ways towards Kubernetes
Cluster-as-code. The Many Ways towards KubernetesCluster-as-code. The Many Ways towards Kubernetes
Cluster-as-code. The Many Ways towards Kubernetes
 
Application Modernisation with PKS
Application Modernisation with PKSApplication Modernisation with PKS
Application Modernisation with PKS
 
Application Modernisation with PKS
Application Modernisation with PKSApplication Modernisation with PKS
Application Modernisation with PKS
 
Salesforce Multitenant Architecture: How We Do the Magic We Do
Salesforce Multitenant Architecture: How We Do the Magic We DoSalesforce Multitenant Architecture: How We Do the Magic We Do
Salesforce Multitenant Architecture: How We Do the Magic We Do
 
RightScale Roadtrip - Accelerate to Cloud
RightScale Roadtrip - Accelerate to CloudRightScale Roadtrip - Accelerate to Cloud
RightScale Roadtrip - Accelerate to Cloud
 
Oracle Blockchain Platform_Wonjo Yoo
Oracle Blockchain Platform_Wonjo YooOracle Blockchain Platform_Wonjo Yoo
Oracle Blockchain Platform_Wonjo Yoo
 
How To Build Kubernetes Policies To Ensure Compliance for Databases.pptx
How To Build Kubernetes Policies To Ensure Compliance for Databases.pptxHow To Build Kubernetes Policies To Ensure Compliance for Databases.pptx
How To Build Kubernetes Policies To Ensure Compliance for Databases.pptx
 
DevOps LA Meetup Intro to Habitat
DevOps LA Meetup Intro to HabitatDevOps LA Meetup Intro to Habitat
DevOps LA Meetup Intro to Habitat
 
Dot NET Solution Architect Roadmap By Scholarhat PDF
Dot NET Solution Architect Roadmap By Scholarhat PDFDot NET Solution Architect Roadmap By Scholarhat PDF
Dot NET Solution Architect Roadmap By Scholarhat PDF
 
Cloud Native Applications on OpenShift
Cloud Native Applications on OpenShiftCloud Native Applications on OpenShift
Cloud Native Applications on OpenShift
 
AWS Sydney Summit 2013 - Continuous Deployment Practices, with Production, Te...
AWS Sydney Summit 2013 - Continuous Deployment Practices, with Production, Te...AWS Sydney Summit 2013 - Continuous Deployment Practices, with Production, Te...
AWS Sydney Summit 2013 - Continuous Deployment Practices, with Production, Te...
 
What are DevOps Application Patterns on AWS…and why do I need them?
What are DevOps Application Patterns on AWS…and why do I need them?What are DevOps Application Patterns on AWS…and why do I need them?
What are DevOps Application Patterns on AWS…and why do I need them?
 
Architecting extremelylarge scale web applications
Architecting extremelylarge scale web applicationsArchitecting extremelylarge scale web applications
Architecting extremelylarge scale web applications
 
Cloud APIs Overview Tucker
Cloud APIs Overview   TuckerCloud APIs Overview   Tucker
Cloud APIs Overview Tucker
 
Srinivasaragavan Jayakumar
Srinivasaragavan JayakumarSrinivasaragavan Jayakumar
Srinivasaragavan Jayakumar
 
Modernizing Testing as Apps Re-Architect
Modernizing Testing as Apps Re-ArchitectModernizing Testing as Apps Re-Architect
Modernizing Testing as Apps Re-Architect
 
Using Apache as an Application Server
Using Apache as an Application ServerUsing Apache as an Application Server
Using Apache as an Application Server
 
Patterns & Practices of Microservices
Patterns & Practices of MicroservicesPatterns & Practices of Microservices
Patterns & Practices of Microservices
 
Value Stream Delivery Platform for ALM, DevOps DevSecOps and Cloud-based SaaS...
Value Stream Delivery Platform for ALM, DevOps DevSecOps and Cloud-based SaaS...Value Stream Delivery Platform for ALM, DevOps DevSecOps and Cloud-based SaaS...
Value Stream Delivery Platform for ALM, DevOps DevSecOps and Cloud-based SaaS...
 

More from Mohith Shrivastava

Successfully retrieving metadata from salesforce org using packages
Successfully retrieving metadata from salesforce org using packagesSuccessfully retrieving metadata from salesforce org using packages
Successfully retrieving metadata from salesforce org using packages
Mohith Shrivastava
 
Deep dive into salesforce connected app part 4
Deep dive into salesforce connected app   part 4Deep dive into salesforce connected app   part 4
Deep dive into salesforce connected app part 4
Mohith Shrivastava
 
Successfully creating unlocked package
Successfully creating unlocked packageSuccessfully creating unlocked package
Successfully creating unlocked package
Mohith Shrivastava
 
Implementing Einstein OCR
Implementing Einstein OCRImplementing Einstein OCR
Implementing Einstein OCR
Mohith Shrivastava
 
Deep dive into salesforce connected app - part 2
Deep dive into salesforce connected app - part 2Deep dive into salesforce connected app - part 2
Deep dive into salesforce connected app - part 2
Mohith Shrivastava
 
Deep dive into salesforce connected app part 1
Deep dive into salesforce connected app   part 1Deep dive into salesforce connected app   part 1
Deep dive into salesforce connected app part 1
Mohith Shrivastava
 
Org dependent salesforce packages
Org dependent salesforce packagesOrg dependent salesforce packages
Org dependent salesforce packages
Mohith Shrivastava
 
Enhance salesforce application performance using lightning platform cache
Enhance salesforce application performance using lightning platform cacheEnhance salesforce application performance using lightning platform cache
Enhance salesforce application performance using lightning platform cache
Mohith Shrivastava
 
Become a rockstar admin
Become a rockstar adminBecome a rockstar admin
Become a rockstar admin
Mohith Shrivastava
 
Build your own dev tools with salesforce cli plugin generator
Build your own dev tools with salesforce cli plugin generatorBuild your own dev tools with salesforce cli plugin generator
Build your own dev tools with salesforce cli plugin generator
Mohith Shrivastava
 
Modular application development using unlocked packages
Modular application development using unlocked packagesModular application development using unlocked packages
Modular application development using unlocked packages
Mohith Shrivastava
 
Introduction to lightning Web Component
Introduction to lightning Web ComponentIntroduction to lightning Web Component
Introduction to lightning Web Component
Mohith Shrivastava
 
Building Apps On Lightning
Building Apps On LightningBuilding Apps On Lightning
Building Apps On Lightning
Mohith Shrivastava
 
Modular Salesforce Application Development Using DX
Modular Salesforce Application Development Using DXModular Salesforce Application Development Using DX
Modular Salesforce Application Development Using DX
Mohith Shrivastava
 
Spring18 Lightning Component Updates
Spring18 Lightning Component UpdatesSpring18 Lightning Component Updates
Spring18 Lightning Component Updates
Mohith Shrivastava
 
Introduction To Service Cloud Snapins SDK
Introduction To Service Cloud Snapins SDKIntroduction To Service Cloud Snapins SDK
Introduction To Service Cloud Snapins SDK
Mohith Shrivastava
 
Introduction to einstein analytics sdk for lightning
Introduction to einstein analytics sdk for lightningIntroduction to einstein analytics sdk for lightning
Introduction to einstein analytics sdk for lightning
Mohith Shrivastava
 
Machine learning with salesforce data using prediction io
Machine learning with salesforce data using prediction ioMachine learning with salesforce data using prediction io
Machine learning with salesforce data using prediction io
Mohith Shrivastava
 
Debugging lightning components-SEDreamin17
Debugging lightning components-SEDreamin17Debugging lightning components-SEDreamin17
Debugging lightning components-SEDreamin17
Mohith Shrivastava
 
Introduction to Analytics Cloud
Introduction to Analytics CloudIntroduction to Analytics Cloud
Introduction to Analytics Cloud
Mohith Shrivastava
 

More from Mohith Shrivastava (20)

Successfully retrieving metadata from salesforce org using packages
Successfully retrieving metadata from salesforce org using packagesSuccessfully retrieving metadata from salesforce org using packages
Successfully retrieving metadata from salesforce org using packages
 
Deep dive into salesforce connected app part 4
Deep dive into salesforce connected app   part 4Deep dive into salesforce connected app   part 4
Deep dive into salesforce connected app part 4
 
Successfully creating unlocked package
Successfully creating unlocked packageSuccessfully creating unlocked package
Successfully creating unlocked package
 
Implementing Einstein OCR
Implementing Einstein OCRImplementing Einstein OCR
Implementing Einstein OCR
 
Deep dive into salesforce connected app - part 2
Deep dive into salesforce connected app - part 2Deep dive into salesforce connected app - part 2
Deep dive into salesforce connected app - part 2
 
Deep dive into salesforce connected app part 1
Deep dive into salesforce connected app   part 1Deep dive into salesforce connected app   part 1
Deep dive into salesforce connected app part 1
 
Org dependent salesforce packages
Org dependent salesforce packagesOrg dependent salesforce packages
Org dependent salesforce packages
 
Enhance salesforce application performance using lightning platform cache
Enhance salesforce application performance using lightning platform cacheEnhance salesforce application performance using lightning platform cache
Enhance salesforce application performance using lightning platform cache
 
Become a rockstar admin
Become a rockstar adminBecome a rockstar admin
Become a rockstar admin
 
Build your own dev tools with salesforce cli plugin generator
Build your own dev tools with salesforce cli plugin generatorBuild your own dev tools with salesforce cli plugin generator
Build your own dev tools with salesforce cli plugin generator
 
Modular application development using unlocked packages
Modular application development using unlocked packagesModular application development using unlocked packages
Modular application development using unlocked packages
 
Introduction to lightning Web Component
Introduction to lightning Web ComponentIntroduction to lightning Web Component
Introduction to lightning Web Component
 
Building Apps On Lightning
Building Apps On LightningBuilding Apps On Lightning
Building Apps On Lightning
 
Modular Salesforce Application Development Using DX
Modular Salesforce Application Development Using DXModular Salesforce Application Development Using DX
Modular Salesforce Application Development Using DX
 
Spring18 Lightning Component Updates
Spring18 Lightning Component UpdatesSpring18 Lightning Component Updates
Spring18 Lightning Component Updates
 
Introduction To Service Cloud Snapins SDK
Introduction To Service Cloud Snapins SDKIntroduction To Service Cloud Snapins SDK
Introduction To Service Cloud Snapins SDK
 
Introduction to einstein analytics sdk for lightning
Introduction to einstein analytics sdk for lightningIntroduction to einstein analytics sdk for lightning
Introduction to einstein analytics sdk for lightning
 
Machine learning with salesforce data using prediction io
Machine learning with salesforce data using prediction ioMachine learning with salesforce data using prediction io
Machine learning with salesforce data using prediction io
 
Debugging lightning components-SEDreamin17
Debugging lightning components-SEDreamin17Debugging lightning components-SEDreamin17
Debugging lightning components-SEDreamin17
 
Introduction to Analytics Cloud
Introduction to Analytics CloudIntroduction to Analytics Cloud
Introduction to Analytics Cloud
 

Recently uploaded

LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
CatarinaPereira64715
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
Product School
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Jeffrey Haguewood
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
Ralf Eggert
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Inflectra
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Product School
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
Frank van Harmelen
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
DianaGray10
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 

Recently uploaded (20)

LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 

Best Practices with Apex in 2022.pdf

  • 4.
  • 5. Automates complex business processes Multi-tenant aware, easy to test, versioned Apex lets us extends platform capabilities Most sought out skill if you are looking to be a Salesforce Developer What’s special about Apex? 100s of billions Yearly Transactions
  • 6. We have divided best practices of Apex into following categories ❏ Security ❏ Performance ❏ Designing For Scale ❏ Reusability ❏ Maintainability Building Enterprise Apps with Apex
  • 7. https://sfdc.co/apex-recipes Apex Recipes Scan the above QR Code to navigate to apex-recipes git repo
  • 9. Improve App Security by Enforcing CRUD/FLS // check for create permission (CRUD Example) CanTheUser.create(new Account()); CanTheUser.read(listcontacts); // check for FLS permission CanTheUser.flsAccessible(‘Opportunity’, ‘Amount’); CanTheUser.flsUpdatable(‘Opportunity’, ‘Amount’); // check for FLS permission when querying new Safely.doQuery(query string); Scan the above QR Code to navigate to Security Recipes
  • 10. Strengthen your Data Security Comply with privacy policies and regulatory requirements ● encrypting data at rest - Use Shield Platform encryption ● encrypt data transmitted over network - Encryption recipes // An Example from Encryption Recipes String toHash = ‘Test Data’; Blob dataToHash = Blob.valueof(toHash); Blob hash = EncryptionRecipes.generateSHA512HashRecipe(dataToHash); EncryptionRecipes.checkSHA512HashRecipe(hash, dataToHash); Scan the above QR Code to navigate to Encryption Recipes
  • 11. Integration Best Practices in Apex ● Use Named Credential ○ Avoid storing username and passwords or API keys if possible ● Understand limits of Apex ○ Apex might not be ideal for every type of integration Scan the above QR Code to navigate to Integration Apex Recipes
  • 13. Improve speed using Platform Cache Platform cache provides memory layer to store session and org data for later reuse. Some use case for platform cache below ● static data ● reused throughout the session/user requests ● expensive to compute or retrieve // An Example from Platform cache recipe // Store in org cache PlatformCacheRecipes.storeValueInOrgCache(‘Account’, ‘Test Account static data’); // Store from org cache PlatformCacheRecipes.getDefaultPartition(PlatformCacheRecipes.PartitionT ype.ORG).get(‘Account’); Scan the above QR Code to navigate to Platform Cache Recipes
  • 15. Code Bulkification & Optimization ● No DML or SOQL inside FOR loops ● Understand Apex governor limits ● Write optimized queries ● Design Code modules that can process collections of records in a single transaction Scan the above QR Code to navigate to Collection Recipes
  • 16. Solve for Large Data Volumes(LDV) Process large chunks of data using Queueables. ● You can find an example of how to process large dataset in serial using queueables in apex recipes ● Design your queuables to be fail proof using Transaction Finalizers Honorable mention to functions. Functions are great way to handle LDV use cases Scan the above QR Code to navigate to LDV Recipes
  • 18. Reusability ● Adopt a trigger framework when writing triggers with one trigger per object ● Apex-Recipes provides an opinionated framework ■ Uses CMDT to control the order of execution ■ A bypass flag to switch off the trigger when needed Scan the above QR Code to navigate to Trigger Recipes
  • 20. Coding Conventions and Standards ● Define and follow a uniform naming conventions ● Avoid hardcoding IDs ● Error Logging Frameworks ○ Fire platform events upon errors ● Use PMD to Scan your apex ● Implement CI & CD for the project to discover breaking changes Scan the above QR Code to navigate to Success Cloud Coding Conventions Trailhead Module
  • 21. Write meaningful tests ● Use test data factories to create and manage reusable data for testing needs ● Use Mocks for testing API callouts ● Use Stub provider to build mocking frameworks for unit testing ● Write meaningful negative tests Scan the above QR Code to navigate to Testing Recipes
  • 22. RAD Women needs your help! radwomen.org/be-a-part- of-radwomen/ @radwomencode