SlideShare uma empresa Scribd logo
1 de 29
Baixar para ler offline
Introduction to Apex Triggers
Arming the Dangerous
Iman Maghroori, Principal Sales Engineer
@IMaghroori
Doug Merrett, Principal Architect
@justinbeiber
Safe harbor
Safe harbor statement under the Private Securities Litigation Reform Act of 1995:
This presentation may contain forward-looking statements that involve risks, uncertainties, and assumptions. If any such uncertainties
materialize or if any of the assumptions proves incorrect, the results of salesforce.com, inc. could differ materially from the results
expressed or implied by the forward-looking statements we make. All statements other than statements of historical fact could be
deemed forward-looking, including any projections of product or service availability, subscriber growth, earnings, revenues, or other
financial items and any statements regarding strategies or plans of management for future operations, statements of belief, any
statements concerning new, planned, or upgraded services or technology developments and customer contracts or use of our services.
The risks and uncertainties referred to above include – but are not limited to – risks associated with developing and delivering new
functionality for our service, new products and services, our new business model, our past operating losses, possible fluctuations in our
operating results and rate of growth, interruptions or delays in our Web hosting, breach of our security measures, the outcome of any
litigation, risks associated with completed and any possible mergers and acquisitions, the immature market in which we operate, our
relatively limited operating history, our ability to expand, retain, and motivate our employees and manage our growth, new releases of our
service and successful customer deployment, our limited history reselling non-salesforce.com products, and utilization and selling to
larger enterprise customers. Further information on potential factors that could affect the financial results of salesforce.com, inc. is
included in our annual report on Form 10-K for the most recent fiscal year and in our quarterly report on Form 10-Q for the most recent
fiscal quarter. These documents and others containing important disclosures are available on the SEC Filings section of the Investor
Information section of our Web site.
Any unreleased services or features referenced in this or other presentations, press releases or public statements are not currently
available and may not be delivered on time or at all. Customers who purchase our services should make the purchase decisions
based upon features that are currently available. Salesforce.com, inc. assumes no obligation and does not intend to update these
forward-looking statements.
Iman Maghroori
Principal Sales Engineer
@IMaghroori
Doug Merrett
Principal Architect – Northern Europe
@justinbeiber
Here is the Plan
What is a
Trigger?
When / Why
Trigger
Deconstruction

Tools
Resources

Q&A
SURVEY: RAISE YOUR HAND IF YOU’VE…






Created a Custom Field?
Created a Workflow/Approval rules?
Written any code before?
Written Apex code?
Written a Trigger before?
What is a Trigger?
What is a Trigger?

“…is procedural code that is
automatically executed in response
to certain events in a database…”
- Wikipedia
What is a Trigger?

“ …custom code that fires
when a record is created,
updated or deleted.”

-Iman Maghroori
What Happens When You Hit “Save”?
What Happens When You Hit “Save”?
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.

Old values are overwritten
System Validation Rules
Apex (before) triggers
Custom Validation Rules
Record saved to DB (not committed)
Record reloaded from DB
Apex (after) triggers
Assignment Rules
Auto-Response Rules
Workflow Rules
Escalation Rules
Rollup Summary Formulas updated
Database Commit
Post-commit logic (Sending emails)
Now You’re Dangerous…
When Should You Use Triggers?
When all other options fail
Don’t write code if you don’t have to
 Easier to maintain
 Easier to change

 Faster to deploy
Workflow Can…
Update Fields
Assign Tasks
Send Emails
Send Outbound Messages (Integrations)
Workflow Cannot…
Create Other Records
 Automatically create child records

Complex Calculations
 Calculate total revenue from child accounts

Automatically Submit Records for Approval
Delete Records
Apex: The Programming Language of Force.com
Object-oriented language
Java-like syntax
6 Billion+ Lines of Apex
Why Apex?
Runs in the Cloud
Integrated to Your Data
Lots of prebuilt capability
Testing Framework

Backward Compatibility
The Force.com Platform is a Multi-Tenant Environment
Use Case: UberJet
Create Invoice Trigger
Mark the Jet as Booked Trigger
Test Your Code!
75% Minimum Code Coverage Before You Deploy
We check for the %, you should check for all the possible use cases.
How to Deploy to Production?
• Make sure your code passes the tests & test coverage

• Create an “Outbound Change Set” and add your updates to it
• Push the Outbound Change Set to your Production Environment
• Accept the Inbound Change Set in your Production Environment.
• Setup → Deploy → Inbound Change Sets → [Change Set] → Deploy
Next Steps to Level Up
• Developer Environment
• Apex Workbook
• To Learn More
Where Can I Go for Help?
•
•
•
•
•
•
•

Developer.force.com
Salesforce.com Training / Certifications
Code Share
Developer Community
Apex Guide
Security Information
Help & Training
Take it to the Next Level: Professional Services
Any Questions?
Introduction to Apex Triggers

Mais conteúdo relacionado

Mais procurados

Build Amazing Website without coding using Salesforce SiteForce
Build Amazing Website without coding using Salesforce SiteForceBuild Amazing Website without coding using Salesforce SiteForce
Build Amazing Website without coding using Salesforce SiteForce
vraopolisetti
 

Mais procurados (20)

Lightning components performance best practices
Lightning components performance best practicesLightning components performance best practices
Lightning components performance best practices
 
Advanced Lightning Components
Advanced Lightning ComponentsAdvanced Lightning Components
Advanced Lightning Components
 
Write bulletproof trigger code
Write bulletproof trigger codeWrite bulletproof trigger code
Write bulletproof trigger code
 
Lightning Components - Advanced Features
Lightning Components - Advanced FeaturesLightning Components - Advanced Features
Lightning Components - Advanced Features
 
Building apps faster with lightning and winter '17
Building apps faster with lightning and winter '17Building apps faster with lightning and winter '17
Building apps faster with lightning and winter '17
 
Using Apex for REST Integration
Using Apex for REST IntegrationUsing Apex for REST Integration
Using Apex for REST Integration
 
SLDS and Lightning Components
SLDS and Lightning ComponentsSLDS and Lightning Components
SLDS and Lightning Components
 
Secure Development on the Salesforce Platform - Part 2
Secure Development on the Salesforce Platform - Part 2Secure Development on the Salesforce Platform - Part 2
Secure Development on the Salesforce Platform - Part 2
 
Process Automation on Lightning Platform Workshop
Process Automation on Lightning Platform WorkshopProcess Automation on Lightning Platform Workshop
Process Automation on Lightning Platform Workshop
 
Build Amazing Website without coding using Salesforce SiteForce
Build Amazing Website without coding using Salesforce SiteForceBuild Amazing Website without coding using Salesforce SiteForce
Build Amazing Website without coding using Salesforce SiteForce
 
Secure Salesforce: Lightning Components Best Practices
Secure Salesforce: Lightning Components Best PracticesSecure Salesforce: Lightning Components Best Practices
Secure Salesforce: Lightning Components Best Practices
 
Secure Development on the Salesforce Platform - Part 3
Secure Development on the Salesforce Platform - Part 3Secure Development on the Salesforce Platform - Part 3
Secure Development on the Salesforce Platform - Part 3
 
Build Consumer-Facing Apps with Heroku Connect
Build Consumer-Facing Apps with Heroku ConnectBuild Consumer-Facing Apps with Heroku Connect
Build Consumer-Facing Apps with Heroku Connect
 
Unlocking the Hidden Potential of Salesforce Live Agent
Unlocking the Hidden Potential of Salesforce Live AgentUnlocking the Hidden Potential of Salesforce Live Agent
Unlocking the Hidden Potential of Salesforce Live Agent
 
Understanding Salesforce Streaming API
Understanding Salesforce Streaming APIUnderstanding Salesforce Streaming API
Understanding Salesforce Streaming API
 
Introduction to lightning out df16
Introduction to lightning out   df16Introduction to lightning out   df16
Introduction to lightning out df16
 
Integrating with salesforce
Integrating with salesforceIntegrating with salesforce
Integrating with salesforce
 
Salesforce API Series: Integrating Applications with Force.com Webinar
Salesforce API Series: Integrating Applications with Force.com WebinarSalesforce API Series: Integrating Applications with Force.com Webinar
Salesforce API Series: Integrating Applications with Force.com Webinar
 
Winter '16 Release - Overview and Highlights
Winter '16 Release - Overview and HighlightsWinter '16 Release - Overview and Highlights
Winter '16 Release - Overview and Highlights
 
TrailheaDX India : Developer Highlights
TrailheaDX India : Developer HighlightsTrailheaDX India : Developer Highlights
TrailheaDX India : Developer Highlights
 

Semelhante a Introduction to Apex Triggers

CCT London 2013 Theatre Intro to Apex
CCT London 2013 Theatre Intro to ApexCCT London 2013 Theatre Intro to Apex
CCT London 2013 Theatre Intro to Apex
Peter Chittum
 

Semelhante a Introduction to Apex Triggers (20)

CCT London 2013 Theatre Intro to Apex
CCT London 2013 Theatre Intro to ApexCCT London 2013 Theatre Intro to Apex
CCT London 2013 Theatre Intro to Apex
 
CodeLive with Cynthia Thomas - Refactoring data dependent code.
CodeLive with Cynthia Thomas - Refactoring data dependent code.CodeLive with Cynthia Thomas - Refactoring data dependent code.
CodeLive with Cynthia Thomas - Refactoring data dependent code.
 
Unleash the Power of Apex Realtime Debugger
Unleash the Power of Apex Realtime DebuggerUnleash the Power of Apex Realtime Debugger
Unleash the Power of Apex Realtime Debugger
 
API Design for Your Packaged App
API Design for Your Packaged AppAPI Design for Your Packaged App
API Design for Your Packaged App
 
Innovation Showcase: Top Financial Services Apps Built on App Cloud
Innovation Showcase: Top Financial Services Apps Built on App CloudInnovation Showcase: Top Financial Services Apps Built on App Cloud
Innovation Showcase: Top Financial Services Apps Built on App Cloud
 
Innovation Showcase: How Amazon and USAA Build Inspiring Apps on App Cloud
Innovation Showcase: How Amazon and USAA Build Inspiring Apps on App CloudInnovation Showcase: How Amazon and USAA Build Inspiring Apps on App Cloud
Innovation Showcase: How Amazon and USAA Build Inspiring Apps on App Cloud
 
Force.com Friday : Intro to Apex
Force.com Friday : Intro to Apex Force.com Friday : Intro to Apex
Force.com Friday : Intro to Apex
 
2016 ISBG - Salesforce App Cloud and Domino - same same, but different
2016 ISBG - Salesforce App Cloud and Domino - same same, but different2016 ISBG - Salesforce App Cloud and Domino - same same, but different
2016 ISBG - Salesforce App Cloud and Domino - same same, but different
 
Build custom user interfaces for your Salesforce data with the UI API
 Build custom user interfaces for your Salesforce data with the UI API Build custom user interfaces for your Salesforce data with the UI API
Build custom user interfaces for your Salesforce data with the UI API
 
Einstein Analytics for Developers
Einstein Analytics for DevelopersEinstein Analytics for Developers
Einstein Analytics for Developers
 
Diving Into Heroku Private Spaces
Diving Into Heroku Private SpacesDiving Into Heroku Private Spaces
Diving Into Heroku Private Spaces
 
Get Started with Lightning Web Components Open Source
Get Started with Lightning Web Components Open SourceGet Started with Lightning Web Components Open Source
Get Started with Lightning Web Components Open Source
 
API Design for Your Packaged App
API Design for Your Packaged AppAPI Design for Your Packaged App
API Design for Your Packaged App
 
Dreamforce 2014 - Salesforce Python SDK for REST/SOAP APIs
Dreamforce 2014 - Salesforce Python SDK for REST/SOAP APIsDreamforce 2014 - Salesforce Python SDK for REST/SOAP APIs
Dreamforce 2014 - Salesforce Python SDK for REST/SOAP APIs
 
Five Developer Tips Every Admin Needs To Know
Five Developer Tips Every Admin Needs To KnowFive Developer Tips Every Admin Needs To Know
Five Developer Tips Every Admin Needs To Know
 
Introduction to Apex Triggers
Introduction to Apex TriggersIntroduction to Apex Triggers
Introduction to Apex Triggers
 
Salesforce Essentials Helsinki 10.5.2017 ExtendCRM Track1
Salesforce Essentials Helsinki 10.5.2017 ExtendCRM Track1Salesforce Essentials Helsinki 10.5.2017 ExtendCRM Track1
Salesforce Essentials Helsinki 10.5.2017 ExtendCRM Track1
 
#DF17Recap series: Integrate apps easier with the Salesforce platform
#DF17Recap series: Integrate apps easier with the Salesforce platform#DF17Recap series: Integrate apps easier with the Salesforce platform
#DF17Recap series: Integrate apps easier with the Salesforce platform
 
Force.com Friday - An Intro to Force.com
Force.com Friday - An Intro to Force.comForce.com Friday - An Intro to Force.com
Force.com Friday - An Intro to Force.com
 
Force.com Friday - Intro to Force.com
Force.com Friday -  Intro to Force.comForce.com Friday -  Intro to Force.com
Force.com Friday - Intro to Force.com
 

Mais de Salesforce Developers

Mais de Salesforce Developers (20)

Sample Gallery: Reference Code and Best Practices for Salesforce Developers
Sample Gallery: Reference Code and Best Practices for Salesforce DevelopersSample Gallery: Reference Code and Best Practices for Salesforce Developers
Sample Gallery: Reference Code and Best Practices for Salesforce Developers
 
Maximizing Salesforce Lightning Experience and Lightning Component Performance
Maximizing Salesforce Lightning Experience and Lightning Component PerformanceMaximizing Salesforce Lightning Experience and Lightning Component Performance
Maximizing Salesforce Lightning Experience and Lightning Component Performance
 
Local development with Open Source Base Components
Local development with Open Source Base ComponentsLocal development with Open Source Base Components
Local development with Open Source Base Components
 
Why developers shouldn’t miss TrailheaDX India
Why developers shouldn’t miss TrailheaDX IndiaWhy developers shouldn’t miss TrailheaDX India
Why developers shouldn’t miss TrailheaDX India
 
CodeLive: Build Lightning Web Components faster with Local Development
CodeLive: Build Lightning Web Components faster with Local DevelopmentCodeLive: Build Lightning Web Components faster with Local Development
CodeLive: Build Lightning Web Components faster with Local Development
 
CodeLive: Converting Aura Components to Lightning Web Components
CodeLive: Converting Aura Components to Lightning Web ComponentsCodeLive: Converting Aura Components to Lightning Web Components
CodeLive: Converting Aura Components to Lightning Web Components
 
Enterprise-grade UI with open source Lightning Web Components
Enterprise-grade UI with open source Lightning Web ComponentsEnterprise-grade UI with open source Lightning Web Components
Enterprise-grade UI with open source Lightning Web Components
 
TrailheaDX and Summer '19: Developer Highlights
TrailheaDX and Summer '19: Developer HighlightsTrailheaDX and Summer '19: Developer Highlights
TrailheaDX and Summer '19: Developer Highlights
 
Live coding with LWC
Live coding with LWCLive coding with LWC
Live coding with LWC
 
Lightning web components - Episode 4 : Security and Testing
Lightning web components  - Episode 4 : Security and TestingLightning web components  - Episode 4 : Security and Testing
Lightning web components - Episode 4 : Security and Testing
 
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
 
Lightning web components episode 2- work with salesforce data
Lightning web components   episode 2- work with salesforce dataLightning web components   episode 2- work with salesforce data
Lightning web components episode 2- work with salesforce data
 
Lightning web components - Episode 1 - An Introduction
Lightning web components - Episode 1 - An IntroductionLightning web components - Episode 1 - An Introduction
Lightning web components - Episode 1 - An Introduction
 
Migrating CPQ to Advanced Calculator and JSQCP
Migrating CPQ to Advanced Calculator and JSQCPMigrating CPQ to Advanced Calculator and JSQCP
Migrating CPQ to Advanced Calculator and JSQCP
 
Scale with Large Data Volumes and Big Objects in Salesforce
Scale with Large Data Volumes and Big Objects in SalesforceScale with Large Data Volumes and Big Objects in Salesforce
Scale with Large Data Volumes and Big Objects in Salesforce
 
Replicate Salesforce Data in Real Time with Change Data Capture
Replicate Salesforce Data in Real Time with Change Data CaptureReplicate Salesforce Data in Real Time with Change Data Capture
Replicate Salesforce Data in Real Time with Change Data Capture
 
Modern Development with Salesforce DX
Modern Development with Salesforce DXModern Development with Salesforce DX
Modern Development with Salesforce DX
 
Get Into Lightning Flow Development
Get Into Lightning Flow DevelopmentGet Into Lightning Flow Development
Get Into Lightning Flow Development
 
Integrate CMS Content Into Lightning Communities with CMS Connect
Integrate CMS Content Into Lightning Communities with CMS ConnectIntegrate CMS Content Into Lightning Communities with CMS Connect
Integrate CMS Content Into Lightning Communities with CMS Connect
 
Introduction to MuleSoft
Introduction to MuleSoftIntroduction to MuleSoft
Introduction to MuleSoft
 

Último

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Último (20)

Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
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...
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
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
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 

Introduction to Apex Triggers

  • 1. Introduction to Apex Triggers Arming the Dangerous Iman Maghroori, Principal Sales Engineer @IMaghroori Doug Merrett, Principal Architect @justinbeiber
  • 2. Safe harbor Safe harbor statement under the Private Securities Litigation Reform Act of 1995: This presentation may contain forward-looking statements that involve risks, uncertainties, and assumptions. If any such uncertainties materialize or if any of the assumptions proves incorrect, the results of salesforce.com, inc. could differ materially from the results expressed or implied by the forward-looking statements we make. All statements other than statements of historical fact could be deemed forward-looking, including any projections of product or service availability, subscriber growth, earnings, revenues, or other financial items and any statements regarding strategies or plans of management for future operations, statements of belief, any statements concerning new, planned, or upgraded services or technology developments and customer contracts or use of our services. The risks and uncertainties referred to above include – but are not limited to – risks associated with developing and delivering new functionality for our service, new products and services, our new business model, our past operating losses, possible fluctuations in our operating results and rate of growth, interruptions or delays in our Web hosting, breach of our security measures, the outcome of any litigation, risks associated with completed and any possible mergers and acquisitions, the immature market in which we operate, our relatively limited operating history, our ability to expand, retain, and motivate our employees and manage our growth, new releases of our service and successful customer deployment, our limited history reselling non-salesforce.com products, and utilization and selling to larger enterprise customers. Further information on potential factors that could affect the financial results of salesforce.com, inc. is included in our annual report on Form 10-K for the most recent fiscal year and in our quarterly report on Form 10-Q for the most recent fiscal quarter. These documents and others containing important disclosures are available on the SEC Filings section of the Investor Information section of our Web site. Any unreleased services or features referenced in this or other presentations, press releases or public statements are not currently available and may not be delivered on time or at all. Customers who purchase our services should make the purchase decisions based upon features that are currently available. Salesforce.com, inc. assumes no obligation and does not intend to update these forward-looking statements.
  • 3. Iman Maghroori Principal Sales Engineer @IMaghroori
  • 4. Doug Merrett Principal Architect – Northern Europe @justinbeiber
  • 5. Here is the Plan What is a Trigger? When / Why Trigger Deconstruction Tools Resources Q&A
  • 6. SURVEY: RAISE YOUR HAND IF YOU’VE…      Created a Custom Field? Created a Workflow/Approval rules? Written any code before? Written Apex code? Written a Trigger before?
  • 7. What is a Trigger?
  • 8. What is a Trigger? “…is procedural code that is automatically executed in response to certain events in a database…” - Wikipedia
  • 9. What is a Trigger? “ …custom code that fires when a record is created, updated or deleted.” -Iman Maghroori
  • 10. What Happens When You Hit “Save”?
  • 11. What Happens When You Hit “Save”? 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. Old values are overwritten System Validation Rules Apex (before) triggers Custom Validation Rules Record saved to DB (not committed) Record reloaded from DB Apex (after) triggers Assignment Rules Auto-Response Rules Workflow Rules Escalation Rules Rollup Summary Formulas updated Database Commit Post-commit logic (Sending emails)
  • 13. When Should You Use Triggers? When all other options fail Don’t write code if you don’t have to  Easier to maintain  Easier to change  Faster to deploy
  • 14. Workflow Can… Update Fields Assign Tasks Send Emails Send Outbound Messages (Integrations)
  • 15. Workflow Cannot… Create Other Records  Automatically create child records Complex Calculations  Calculate total revenue from child accounts Automatically Submit Records for Approval Delete Records
  • 16. Apex: The Programming Language of Force.com Object-oriented language Java-like syntax 6 Billion+ Lines of Apex
  • 17. Why Apex? Runs in the Cloud Integrated to Your Data Lots of prebuilt capability Testing Framework Backward Compatibility
  • 18. The Force.com Platform is a Multi-Tenant Environment
  • 21.
  • 22. Mark the Jet as Booked Trigger
  • 24. 75% Minimum Code Coverage Before You Deploy We check for the %, you should check for all the possible use cases.
  • 25. How to Deploy to Production? • Make sure your code passes the tests & test coverage • Create an “Outbound Change Set” and add your updates to it • Push the Outbound Change Set to your Production Environment • Accept the Inbound Change Set in your Production Environment. • Setup → Deploy → Inbound Change Sets → [Change Set] → Deploy
  • 26. Next Steps to Level Up • Developer Environment • Apex Workbook • To Learn More
  • 27. Where Can I Go for Help? • • • • • • • Developer.force.com Salesforce.com Training / Certifications Code Share Developer Community Apex Guide Security Information Help & Training Take it to the Next Level: Professional Services