SlideShare una empresa de Scribd logo
1 de 14
Salesforce Admin Group,Trichy
Deep study
on Asynchronous Apex
Kadhar Basha J
Salesforce Admin Group, Trichy
Trailblazer Community Group Leader
Sundaravel J
Salesforce Admin Group, Trichy
Trailblazer Community Group Co-Leader
Salesforce Admin Group,Trichy
Salesforce Admin Group,Trichy
Speaker
Mohamed Javith Shet Mohamad
Today’s Agenda
• Introduction
• Asynchronous Apex
• Scenarios
• Demo
• Questions & Answers
Synchronous Apex
• Occurring at the same time.
• Quick and Immediate actions.
• Transactions are immediate and serial.
• Normal Governor Limits
Asynchronous Apex
• Not occurring at the same time.
• Executes when resources are available.
• Not immediate.
• Higher Governor Limits.
Governor Limits
Description Synchronous Limit Asynchronous Limit
Total number of SOQL queries
issued
100 200
Total number of records
retrieved by SOQL queries
50000 50000
Total number of records
retrieved by
Database.getQueryLocator
10000 10000
Total number of SOSL queries
issued
20 20
Total number of records
retrieved by a single SOSL query
2000 2000
Total number of DML
statements issued
150 150
Total heap size 6 MB 12 MB
Maximum CPU time on the
Salesforce servers
10000 ms 60000 ms
Example scenario
Update a record Trigger will fire
Need to insert more
than 10000 or query
50000 records
Use asynchronous
apex
Transaction
completes. But
asynchronous apex
may still be running.
Types
Future Apex
• @future annotation at the start of method.
• Always method should be public static and return type should be void.
• The specified parameters must be primitive data types, arrays of primitive data
types, or collections of primitive data types; future methods can’t take objects as
arguments.
• Future methods won’t necessarily execute in the same order they are called. In
addition, it’s possible that two future methods could run concurrently, which
could result in record locking if the two methods were updating the same record.
• You’re limited to 50 future calls per Apex invocation, and there’s an additional
limit on the number of calls in a 24-hour period.
• Cannot call another future method from a future method.
Batch Apex
• Has a different syntax.
• Every transaction starts with a new set of governor limits.
• If one batch fails to process successfully, all other successful batch transactions
aren’t rolled back.
• Start, Execute and Finish are the 3 methods.
• Can track the progress of batch in the apex job page in setup.
• 5 batch jobs at a given time
• You can call another batch from batch or queue but not future method.
• What happens when more than 5 batch jobs are invoked?
Queueable Apex
• Similar to future apex.
• Accepts non primitive datatypes too.
• Can call another queue. (Only one)
• Progress can be tracked in apex batch jobs page.
• You can add up to 50 jobs to the queue with System.enqueueJob in a single
transaction.
Schedulable Apex
• Runs apex class at a specified time and frequency.
• Can be scheduled in UI or using cron jobs.
• Scheduled jobs can be tracked from scheduled jobs page in setup.
• You can only have 100 scheduled Apex jobs at one time
Note: Always asynchronous apex should be executed within startTest() and
stopTest().
Asynchronous Apex .pptx
Asynchronous Apex .pptx

Más contenido relacionado

Similar a Asynchronous Apex .pptx

Processing large volume of data with MuleSoft and salesforce.pptx
Processing large volume of data with MuleSoft and salesforce.pptxProcessing large volume of data with MuleSoft and salesforce.pptx
Processing large volume of data with MuleSoft and salesforce.pptxPankaj Goyal
 
Processing large volume of data with MuleSoft and salesforce.pptx
Processing large volume of data with MuleSoft and salesforce.pptxProcessing large volume of data with MuleSoft and salesforce.pptx
Processing large volume of data with MuleSoft and salesforce.pptxPankajGoyal164048
 
BTV PHP - Building Fast Websites
BTV PHP - Building Fast WebsitesBTV PHP - Building Fast Websites
BTV PHP - Building Fast WebsitesJonathan Klein
 
Episode 18 - Asynchronous Apex
Episode 18 - Asynchronous ApexEpisode 18 - Asynchronous Apex
Episode 18 - Asynchronous ApexJitendra Zaa
 
Crating a Robust Performance Strategy
Crating a Robust Performance StrategyCrating a Robust Performance Strategy
Crating a Robust Performance StrategyGuatemala User Group
 
Batch Apex in Salesforce
Batch Apex in SalesforceBatch Apex in Salesforce
Batch Apex in SalesforceDavid Helgerson
 
Performance Tuning and Optimization
Performance Tuning and OptimizationPerformance Tuning and Optimization
Performance Tuning and OptimizationMongoDB
 
Building an Experimentation Platform in Clojure
Building an Experimentation Platform in ClojureBuilding an Experimentation Platform in Clojure
Building an Experimentation Platform in ClojureSrihari Sriraman
 
End to-end async and await
End to-end async and awaitEnd to-end async and await
End to-end async and awaitvfabro
 
ExpressionEngine - Simple Steps to Performance and Security (EECI 2014)
ExpressionEngine - Simple Steps to Performance and Security (EECI 2014)ExpressionEngine - Simple Steps to Performance and Security (EECI 2014)
ExpressionEngine - Simple Steps to Performance and Security (EECI 2014)Nexcess.net LLC
 
Performance tuning Grails applications
 Performance tuning Grails applications Performance tuning Grails applications
Performance tuning Grails applicationsGR8Conf
 
Secrets of highly_avail_oltp_archs
Secrets of highly_avail_oltp_archsSecrets of highly_avail_oltp_archs
Secrets of highly_avail_oltp_archsTarik Essawi
 
Performance tuning Grails applications
Performance tuning Grails applicationsPerformance tuning Grails applications
Performance tuning Grails applicationsLari Hotari
 
Entity framework advanced
Entity framework advancedEntity framework advanced
Entity framework advancedUsama Nada
 
Salesforce Meetup 18 April 2015 - Apex Trigger & Scheduler Framworks
Salesforce Meetup 18 April 2015 - Apex Trigger & Scheduler FramworksSalesforce Meetup 18 April 2015 - Apex Trigger & Scheduler Framworks
Salesforce Meetup 18 April 2015 - Apex Trigger & Scheduler FramworksSumitkumar Shingavi
 
OpenERP Performance Benchmark
OpenERP Performance BenchmarkOpenERP Performance Benchmark
OpenERP Performance BenchmarkAudaxis
 
[Srijan Wednesday Webinar] Easy Performance Wins for Your Rails App
[Srijan Wednesday Webinar] Easy Performance Wins for Your Rails App[Srijan Wednesday Webinar] Easy Performance Wins for Your Rails App
[Srijan Wednesday Webinar] Easy Performance Wins for Your Rails AppSrijan Technologies
 
High Performance Mysql
High Performance MysqlHigh Performance Mysql
High Performance Mysqlliufabin 66688
 

Similar a Asynchronous Apex .pptx (20)

Processing large volume of data with MuleSoft and salesforce.pptx
Processing large volume of data with MuleSoft and salesforce.pptxProcessing large volume of data with MuleSoft and salesforce.pptx
Processing large volume of data with MuleSoft and salesforce.pptx
 
Processing large volume of data with MuleSoft and salesforce.pptx
Processing large volume of data with MuleSoft and salesforce.pptxProcessing large volume of data with MuleSoft and salesforce.pptx
Processing large volume of data with MuleSoft and salesforce.pptx
 
BTV PHP - Building Fast Websites
BTV PHP - Building Fast WebsitesBTV PHP - Building Fast Websites
BTV PHP - Building Fast Websites
 
Episode 18 - Asynchronous Apex
Episode 18 - Asynchronous ApexEpisode 18 - Asynchronous Apex
Episode 18 - Asynchronous Apex
 
Crating a Robust Performance Strategy
Crating a Robust Performance StrategyCrating a Robust Performance Strategy
Crating a Robust Performance Strategy
 
Scaling tappsi
Scaling tappsiScaling tappsi
Scaling tappsi
 
Batch Apex in Salesforce
Batch Apex in SalesforceBatch Apex in Salesforce
Batch Apex in Salesforce
 
Performance Tuning and Optimization
Performance Tuning and OptimizationPerformance Tuning and Optimization
Performance Tuning and Optimization
 
Building an Experimentation Platform in Clojure
Building an Experimentation Platform in ClojureBuilding an Experimentation Platform in Clojure
Building an Experimentation Platform in Clojure
 
End to-end async and await
End to-end async and awaitEnd to-end async and await
End to-end async and await
 
ExpressionEngine - Simple Steps to Performance and Security (EECI 2014)
ExpressionEngine - Simple Steps to Performance and Security (EECI 2014)ExpressionEngine - Simple Steps to Performance and Security (EECI 2014)
ExpressionEngine - Simple Steps to Performance and Security (EECI 2014)
 
Performance tuning Grails applications
 Performance tuning Grails applications Performance tuning Grails applications
Performance tuning Grails applications
 
Secrets of highly_avail_oltp_archs
Secrets of highly_avail_oltp_archsSecrets of highly_avail_oltp_archs
Secrets of highly_avail_oltp_archs
 
Performance tuning Grails applications
Performance tuning Grails applicationsPerformance tuning Grails applications
Performance tuning Grails applications
 
Entity framework advanced
Entity framework advancedEntity framework advanced
Entity framework advanced
 
Salesforce Meetup 18 April 2015 - Apex Trigger & Scheduler Framworks
Salesforce Meetup 18 April 2015 - Apex Trigger & Scheduler FramworksSalesforce Meetup 18 April 2015 - Apex Trigger & Scheduler Framworks
Salesforce Meetup 18 April 2015 - Apex Trigger & Scheduler Framworks
 
OpenERP Performance Benchmark
OpenERP Performance BenchmarkOpenERP Performance Benchmark
OpenERP Performance Benchmark
 
[Srijan Wednesday Webinar] Easy Performance Wins for Your Rails App
[Srijan Wednesday Webinar] Easy Performance Wins for Your Rails App[Srijan Wednesday Webinar] Easy Performance Wins for Your Rails App
[Srijan Wednesday Webinar] Easy Performance Wins for Your Rails App
 
High Performance Mysql
High Performance MysqlHigh Performance Mysql
High Performance Mysql
 
Critical section operating system
Critical section  operating systemCritical section  operating system
Critical section operating system
 

Más de KadharBashaJ

A Review on LWC Events for communication.pptx
A Review on LWC Events for communication.pptxA Review on LWC Events for communication.pptx
A Review on LWC Events for communication.pptxKadharBashaJ
 
Winter'23 Release Updates.pptx
Winter'23 Release Updates.pptxWinter'23 Release Updates.pptx
Winter'23 Release Updates.pptxKadharBashaJ
 
Review on Data Security.pptx
Review on Data Security.pptxReview on Data Security.pptx
Review on Data Security.pptxKadharBashaJ
 
Flow With Aura.pptx
Flow With Aura.pptxFlow With Aura.pptx
Flow With Aura.pptxKadharBashaJ
 
Flow builder series i
Flow builder series iFlow builder series i
Flow builder series iKadharBashaJ
 
Tour to docgen lightning experience
Tour to docgen lightning experienceTour to docgen lightning experience
Tour to docgen lightning experienceKadharBashaJ
 
Winter 22 features
Winter 22 featuresWinter 22 features
Winter 22 featuresKadharBashaJ
 
DocuSign Power Form
DocuSign Power FormDocuSign Power Form
DocuSign Power FormKadharBashaJ
 
Publish and subscribe platform events using flows
Publish and subscribe platform events using flowsPublish and subscribe platform events using flows
Publish and subscribe platform events using flowsKadharBashaJ
 
Multi language support for salesforce community portal
Multi language support for salesforce community portalMulti language support for salesforce community portal
Multi language support for salesforce community portalKadharBashaJ
 
Simplified appointment scheduling using lightning scheduler
Simplified appointment scheduling using lightning schedulerSimplified appointment scheduling using lightning scheduler
Simplified appointment scheduling using lightning schedulerKadharBashaJ
 
How to crack Admin and Advanced Admin
How to crack Admin and Advanced AdminHow to crack Admin and Advanced Admin
How to crack Admin and Advanced AdminKadharBashaJ
 
How to crack java script certification
How to crack java script certificationHow to crack java script certification
How to crack java script certificationKadharBashaJ
 
Master tableau 20 in data science by solving real life analytics problems
Master tableau 20 in data science by solving real life analytics problemsMaster tableau 20 in data science by solving real life analytics problems
Master tableau 20 in data science by solving real life analytics problemsKadharBashaJ
 
Low code love salesforce automation tool vs apex code
Low code love salesforce automation tool vs apex codeLow code love salesforce automation tool vs apex code
Low code love salesforce automation tool vs apex codeKadharBashaJ
 
Qa mockup interview for automation testing
Qa mockup interview for automation testingQa mockup interview for automation testing
Qa mockup interview for automation testingKadharBashaJ
 
Qa mock up interview for manual testing
Qa mock up interview for manual testingQa mock up interview for manual testing
Qa mock up interview for manual testingKadharBashaJ
 
Docu sign integration with salesforce beginner learning series integration...
Docu sign integration with salesforce   beginner learning series  integration...Docu sign integration with salesforce   beginner learning series  integration...
Docu sign integration with salesforce beginner learning series integration...KadharBashaJ
 

Más de KadharBashaJ (20)

A Review on LWC Events for communication.pptx
A Review on LWC Events for communication.pptxA Review on LWC Events for communication.pptx
A Review on LWC Events for communication.pptx
 
Winter'23 Release Updates.pptx
Winter'23 Release Updates.pptxWinter'23 Release Updates.pptx
Winter'23 Release Updates.pptx
 
Review on Data Security.pptx
Review on Data Security.pptxReview on Data Security.pptx
Review on Data Security.pptx
 
Flow With Aura.pptx
Flow With Aura.pptxFlow With Aura.pptx
Flow With Aura.pptx
 
Conga composer
Conga composerConga composer
Conga composer
 
Flow builder series i
Flow builder series iFlow builder series i
Flow builder series i
 
Tour to docgen lightning experience
Tour to docgen lightning experienceTour to docgen lightning experience
Tour to docgen lightning experience
 
Winter 22 features
Winter 22 featuresWinter 22 features
Winter 22 features
 
DocuSign Power Form
DocuSign Power FormDocuSign Power Form
DocuSign Power Form
 
Formstack
FormstackFormstack
Formstack
 
Publish and subscribe platform events using flows
Publish and subscribe platform events using flowsPublish and subscribe platform events using flows
Publish and subscribe platform events using flows
 
Multi language support for salesforce community portal
Multi language support for salesforce community portalMulti language support for salesforce community portal
Multi language support for salesforce community portal
 
Simplified appointment scheduling using lightning scheduler
Simplified appointment scheduling using lightning schedulerSimplified appointment scheduling using lightning scheduler
Simplified appointment scheduling using lightning scheduler
 
How to crack Admin and Advanced Admin
How to crack Admin and Advanced AdminHow to crack Admin and Advanced Admin
How to crack Admin and Advanced Admin
 
How to crack java script certification
How to crack java script certificationHow to crack java script certification
How to crack java script certification
 
Master tableau 20 in data science by solving real life analytics problems
Master tableau 20 in data science by solving real life analytics problemsMaster tableau 20 in data science by solving real life analytics problems
Master tableau 20 in data science by solving real life analytics problems
 
Low code love salesforce automation tool vs apex code
Low code love salesforce automation tool vs apex codeLow code love salesforce automation tool vs apex code
Low code love salesforce automation tool vs apex code
 
Qa mockup interview for automation testing
Qa mockup interview for automation testingQa mockup interview for automation testing
Qa mockup interview for automation testing
 
Qa mock up interview for manual testing
Qa mock up interview for manual testingQa mock up interview for manual testing
Qa mock up interview for manual testing
 
Docu sign integration with salesforce beginner learning series integration...
Docu sign integration with salesforce   beginner learning series  integration...Docu sign integration with salesforce   beginner learning series  integration...
Docu sign integration with salesforce beginner learning series integration...
 

Último

EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 

Último (20)

EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 

Asynchronous Apex .pptx

  • 1. Salesforce Admin Group,Trichy Deep study on Asynchronous Apex
  • 2. Kadhar Basha J Salesforce Admin Group, Trichy Trailblazer Community Group Leader Sundaravel J Salesforce Admin Group, Trichy Trailblazer Community Group Co-Leader Salesforce Admin Group,Trichy
  • 4. Today’s Agenda • Introduction • Asynchronous Apex • Scenarios • Demo • Questions & Answers
  • 5. Synchronous Apex • Occurring at the same time. • Quick and Immediate actions. • Transactions are immediate and serial. • Normal Governor Limits Asynchronous Apex • Not occurring at the same time. • Executes when resources are available. • Not immediate. • Higher Governor Limits.
  • 6. Governor Limits Description Synchronous Limit Asynchronous Limit Total number of SOQL queries issued 100 200 Total number of records retrieved by SOQL queries 50000 50000 Total number of records retrieved by Database.getQueryLocator 10000 10000 Total number of SOSL queries issued 20 20 Total number of records retrieved by a single SOSL query 2000 2000 Total number of DML statements issued 150 150 Total heap size 6 MB 12 MB Maximum CPU time on the Salesforce servers 10000 ms 60000 ms
  • 7. Example scenario Update a record Trigger will fire Need to insert more than 10000 or query 50000 records Use asynchronous apex Transaction completes. But asynchronous apex may still be running.
  • 9. Future Apex • @future annotation at the start of method. • Always method should be public static and return type should be void. • The specified parameters must be primitive data types, arrays of primitive data types, or collections of primitive data types; future methods can’t take objects as arguments. • Future methods won’t necessarily execute in the same order they are called. In addition, it’s possible that two future methods could run concurrently, which could result in record locking if the two methods were updating the same record. • You’re limited to 50 future calls per Apex invocation, and there’s an additional limit on the number of calls in a 24-hour period. • Cannot call another future method from a future method.
  • 10. Batch Apex • Has a different syntax. • Every transaction starts with a new set of governor limits. • If one batch fails to process successfully, all other successful batch transactions aren’t rolled back. • Start, Execute and Finish are the 3 methods. • Can track the progress of batch in the apex job page in setup. • 5 batch jobs at a given time • You can call another batch from batch or queue but not future method. • What happens when more than 5 batch jobs are invoked?
  • 11. Queueable Apex • Similar to future apex. • Accepts non primitive datatypes too. • Can call another queue. (Only one) • Progress can be tracked in apex batch jobs page. • You can add up to 50 jobs to the queue with System.enqueueJob in a single transaction.
  • 12. Schedulable Apex • Runs apex class at a specified time and frequency. • Can be scheduled in UI or using cron jobs. • Scheduled jobs can be tracked from scheduled jobs page in setup. • You can only have 100 scheduled Apex jobs at one time Note: Always asynchronous apex should be executed within startTest() and stopTest().