SlideShare a Scribd company logo
Partition Your Trigger Logic Using
Metadata
Mitch Spano
Application Engineer - Google
@mitchspano
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 Website.
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.
Statement under the Private Securities Litigation Reform Act of
1995
Forward-Looking Statement
Speakers
Mitch Spano
Application Engineer - Google
@mitchspano
If you are an Architect...
• Consider how this framework
can enable your organization
to grow and scale
• Listen for strategies to better
partition your application
If you are a Developer...
• Learn how a metadata driven
trigger framework can allow
you to deliver higher quality
Apex code
• Observe the techniques used
to test Apex used in this
project
If you are a Manager...
• Gain an understanding of the
complexities of working in an
Apex trigger
• Imagine ways this could be
used in a multiple team
environment
Intended Audience
What should you take from this discussion?
Apex Triggers
Background and History
Many Automation Tools
Relative Risk and Power
Flow
Process Builder
Workflow
No Automation
Triggers
Less
Risk/Power
More
Risk/Power
Trigger Logic
Things can get messy
public class OpportunityTriggerHandler extends TriggerHandler {
public override void beforeUpdate() {
for(Opportunity o : (List<Opportunity>) Trigger.new) {
// do something
}
}
// override additional contexts as necessary
}
Existing Frameworks
Separate Trigger from Logic
public class OpportunityTriggerHandler extends TriggerHandler {
public override void afterInsert() {
this.handleWholesaleInsert((List<Opportunity>) Trigger.new);
this.handleRetailInsert((List<Opportunity>) Trigger.new);
}
private void handleWholesaleInsert(List<Opportunity> newList) {
for(Opportunity o : newList) {
// do something
}
}
private void handleRetailInsert(List<Opportunity> newList) {
for(Opportunity o : newList) {
// do something
}
}
}
Existing Frameworks
Handlers Require Modification
public class OpportunityTriggerHandler extends TriggerHandler {
public override void afterInsert() {
this.handleWholesaleInsert((List<Opportunity>) Trigger.new);
this.handleRetailInsert((List<Opportunity>) Trigger.new);
this.recalculateAccountValues((List<Opportunity>) Trigger.new);
this.notifyAMEASales((List<Opportunity>) Trigger.new);
this.setDefaultAccountType((List<Opportunity>) Trigger.new);
this.defineOpportunityContactRoles((List<Opportunity>) Trigger.new);
}
private void handleWholesaleInsert(List<Opportunity> newList) {
for(Opportunity o : newList) {
// do something
}
}
// More methods are implemented and called for every action :(
}
Existing Frameworks
Becomes Unmaintainable
Trigger Actions Framework
A Metadata Driven Approach
Trigger Framework
GitHub Information
https://github.com/mitchspano/apex-trigger-actions-framework
Trigger Framework
Classes and Metadata Types
Trigger Framework
Classes and Metadata Types
Work Together in Teams
Strategies for Working in a Multiple-Team Environment
Working in Multiple Teams
New Package Directories
{
"packageDirectories": [
{
"path": "application/base"
},
{
"path": "application/opportunity-automation"
},
{
"path": "application/retail"
},
{
"path": "application/wholesale",
"default": true
}
],
"namespace": "",
"sfdcLoginUrl": "https://login.salesforce.com",
"sourceApiVersion": "50.0"
}
Working in Multiple Teams
Use the Order
Order__c: 2.071
Team Prefix Order
Working in Multiple Teams
Use the Order
Partition Your  (Apex) Trigger Logic Using Metadata

More Related Content

What's hot (20)

PDF
はじめようLightning Component開発
Salesforce Developers Japan
 
PPTX
How to Weave Diversity and Inclusion into Your Company's DNA by Brad Schneide...
Salesforce Admins
 
PDF
Spring '17開発者向け新機能
Salesforce Developers Japan
 
PDF
アプリを作った後の運用は万全? Heroku リリース & 運用セミナー
Salesforce Developers Japan
 
PDF
アドバンスドLightningコンポーネント:品質の高いコンポーネント開発のためのTips
Salesforce Developers Japan
 
PDF
Review, Test and Go! - Deborah Paterick, Helen Lueck, Frank Montoya
Salesforce Admins
 
PDF
DF15_ReviewTestGo
Debbie Paterick
 
PPTX
Rollin' Out Lightnin' Ain't All That Frightenin' by Jon Barlow
Salesforce Admins
 
PDF
Winter '19 開発者向け新機能
Salesforce Developers Japan
 
PDF
Winter '18 開発者向け新機能
Salesforce Developers Japan
 
PPTX
Sandboxes: The Future of App Development by Evan Barnet & Pam Barnet
Salesforce Admins
 
PDF
Wave : Analytics Cloudとは
Mitch Okamoto
 
PDF
Summer '17 リリース開発者向け新機能Webinar
Salesforce Developers Japan
 
PPTX
Dallas Salesforce User Group Meeting - March 2011 (Sponsored by Statera)
Kevin Richardson
 
PDF
アプリケーション開発をモダンに変える Salesforce DX
Salesforce Developers Japan
 
PPTX
I Built in Lightning and I Liked It
Salesforce Admins
 
PPTX
April 9 process capability analysis using confidence reliability calculations
Compliance Trainings
 
PDF
Using the D3 JavaScript Library to Create Modular Visualizations
Salesforce Developers
 
PDF
Batch Jobs: Beyond the Basics
Salesforce Developers
 
PPTX
CCT London 2013 Theatre Intro to Apex
Peter Chittum
 
はじめようLightning Component開発
Salesforce Developers Japan
 
How to Weave Diversity and Inclusion into Your Company's DNA by Brad Schneide...
Salesforce Admins
 
Spring '17開発者向け新機能
Salesforce Developers Japan
 
アプリを作った後の運用は万全? Heroku リリース & 運用セミナー
Salesforce Developers Japan
 
アドバンスドLightningコンポーネント:品質の高いコンポーネント開発のためのTips
Salesforce Developers Japan
 
Review, Test and Go! - Deborah Paterick, Helen Lueck, Frank Montoya
Salesforce Admins
 
DF15_ReviewTestGo
Debbie Paterick
 
Rollin' Out Lightnin' Ain't All That Frightenin' by Jon Barlow
Salesforce Admins
 
Winter '19 開発者向け新機能
Salesforce Developers Japan
 
Winter '18 開発者向け新機能
Salesforce Developers Japan
 
Sandboxes: The Future of App Development by Evan Barnet & Pam Barnet
Salesforce Admins
 
Wave : Analytics Cloudとは
Mitch Okamoto
 
Summer '17 リリース開発者向け新機能Webinar
Salesforce Developers Japan
 
Dallas Salesforce User Group Meeting - March 2011 (Sponsored by Statera)
Kevin Richardson
 
アプリケーション開発をモダンに変える Salesforce DX
Salesforce Developers Japan
 
I Built in Lightning and I Liked It
Salesforce Admins
 
April 9 process capability analysis using confidence reliability calculations
Compliance Trainings
 
Using the D3 JavaScript Library to Create Modular Visualizations
Salesforce Developers
 
Batch Jobs: Beyond the Basics
Salesforce Developers
 
CCT London 2013 Theatre Intro to Apex
Peter Chittum
 

Similar to Partition Your (Apex) Trigger Logic Using Metadata (20)

PPTX
Orchestrate all of your salesforce automation with the trigger actions framework
Sudipta Deb ☁
 
PDF
Introduction to Apex Triggers
Salesforce Developers
 
PDF
Introduction to Apex Triggers
Salesforce Developers
 
PDF
Introduction to Apex Triggers
Salesforce Developers
 
PPTX
Deep Dive into Apex Triggers
Salesforce Developers
 
PPTX
Force.com Friday : Intro to Apex
Salesforce Developers
 
PPTX
Route your triggers like a pro #DF18
Daniel Stange
 
PPTX
Intro to Apex - Salesforce Force Friday Webinar
Abhinav Gupta
 
PPTX
Unleash the Power of Apex Realtime Debugger
Salesforce Developers
 
PDF
Just-In-Time Sharing Using Apex
Salesforce Developers
 
PPTX
Apex for Admins: Get Started with Apex in 30 Minutes! (part 1)
Salesforce Developers
 
PDF
Using Apache Spark for Intelligent Services: Keynote at Spark Summit East by ...
Spark Summit
 
PDF
TrailheaDX 2019 : Explore New Frontiers with High Volume Platform Events
John Brock
 
PDF
Intro to Apex Programmers
Salesforce Developers
 
PDF
TrailheaDX 2019 : Truly Asynchronous Apex Triggers using Change Data Capture
John Brock
 
PPTX
Architecting in the Cloud: Choosing the Right Technologies for your Solution
Jeff Douglas
 
PPT
Apex Trigger Debugging: Solving the Hard Problems
Salesforce Developers
 
PDF
Elevate workshop track1
Salesforce Developers
 
PDF
Force.com Friday: Intro to Force.com
Salesforce Developers
 
PDF
Five Developer Tips Every Admin Needs To Know
Salesforce Developers
 
Orchestrate all of your salesforce automation with the trigger actions framework
Sudipta Deb ☁
 
Introduction to Apex Triggers
Salesforce Developers
 
Introduction to Apex Triggers
Salesforce Developers
 
Introduction to Apex Triggers
Salesforce Developers
 
Deep Dive into Apex Triggers
Salesforce Developers
 
Force.com Friday : Intro to Apex
Salesforce Developers
 
Route your triggers like a pro #DF18
Daniel Stange
 
Intro to Apex - Salesforce Force Friday Webinar
Abhinav Gupta
 
Unleash the Power of Apex Realtime Debugger
Salesforce Developers
 
Just-In-Time Sharing Using Apex
Salesforce Developers
 
Apex for Admins: Get Started with Apex in 30 Minutes! (part 1)
Salesforce Developers
 
Using Apache Spark for Intelligent Services: Keynote at Spark Summit East by ...
Spark Summit
 
TrailheaDX 2019 : Explore New Frontiers with High Volume Platform Events
John Brock
 
Intro to Apex Programmers
Salesforce Developers
 
TrailheaDX 2019 : Truly Asynchronous Apex Triggers using Change Data Capture
John Brock
 
Architecting in the Cloud: Choosing the Right Technologies for your Solution
Jeff Douglas
 
Apex Trigger Debugging: Solving the Hard Problems
Salesforce Developers
 
Elevate workshop track1
Salesforce Developers
 
Force.com Friday: Intro to Force.com
Salesforce Developers
 
Five Developer Tips Every Admin Needs To Know
Salesforce Developers
 
Ad

Recently uploaded (20)

PDF
Meet in the Middle: Solving the Low-Latency Challenge for Agentic AI
Alluxio, Inc.
 
PPTX
Library_Management_System_PPT111111.pptx
nmtnissancrm
 
PPTX
prodad heroglyph crack 2.0.214.2 Full Free Download
cracked shares
 
PDF
Top Agile Project Management Tools for Teams in 2025
Orangescrum
 
PDF
intro_to_cpp_namespace_robotics_corner.pdf
MohamedSaied877003
 
PDF
AI + DevOps = Smart Automation with devseccops.ai.pdf
Devseccops.ai
 
PDF
MiniTool Partition Wizard Free Crack + Full Free Download 2025
bashirkhan333g
 
PDF
MiniTool Power Data Recovery 8.8 With Crack New Latest 2025
bashirkhan333g
 
PDF
[Solution] Why Choose the VeryPDF DRM Protector Custom-Built Solution for You...
Lingwen1998
 
PDF
NPD Software -Omnex systems
omnex systems
 
PDF
Everything you need to know about pricing & licensing Microsoft 365 Copilot f...
Q-Advise
 
PPTX
BB FlashBack Pro 5.61.0.4843 With Crack Free Download
cracked shares
 
PPTX
Smart Doctor Appointment Booking option in odoo.pptx
AxisTechnolabs
 
PDF
How to Hire AI Developers_ Step-by-Step Guide in 2025.pdf
DianApps Technologies
 
PDF
AOMEI Partition Assistant Crack 10.8.2 + WinPE Free Downlaod New Version 2025
bashirkhan333g
 
PPTX
Get Started with Maestro: Agent, Robot, and Human in Action – Session 5 of 5
klpathrudu
 
PPTX
Prompt Like a Pro. Leveraging Salesforce Data to Power AI Workflows.pptx
Dele Amefo
 
PPTX
Function & Procedure: Function Vs Procedure in PL/SQL
Shani Tiwari
 
PPTX
From spreadsheets and delays to real-time control
SatishKumar2651
 
PDF
Technical-Careers-Roadmap-in-Software-Market.pdf
Hussein Ali
 
Meet in the Middle: Solving the Low-Latency Challenge for Agentic AI
Alluxio, Inc.
 
Library_Management_System_PPT111111.pptx
nmtnissancrm
 
prodad heroglyph crack 2.0.214.2 Full Free Download
cracked shares
 
Top Agile Project Management Tools for Teams in 2025
Orangescrum
 
intro_to_cpp_namespace_robotics_corner.pdf
MohamedSaied877003
 
AI + DevOps = Smart Automation with devseccops.ai.pdf
Devseccops.ai
 
MiniTool Partition Wizard Free Crack + Full Free Download 2025
bashirkhan333g
 
MiniTool Power Data Recovery 8.8 With Crack New Latest 2025
bashirkhan333g
 
[Solution] Why Choose the VeryPDF DRM Protector Custom-Built Solution for You...
Lingwen1998
 
NPD Software -Omnex systems
omnex systems
 
Everything you need to know about pricing & licensing Microsoft 365 Copilot f...
Q-Advise
 
BB FlashBack Pro 5.61.0.4843 With Crack Free Download
cracked shares
 
Smart Doctor Appointment Booking option in odoo.pptx
AxisTechnolabs
 
How to Hire AI Developers_ Step-by-Step Guide in 2025.pdf
DianApps Technologies
 
AOMEI Partition Assistant Crack 10.8.2 + WinPE Free Downlaod New Version 2025
bashirkhan333g
 
Get Started with Maestro: Agent, Robot, and Human in Action – Session 5 of 5
klpathrudu
 
Prompt Like a Pro. Leveraging Salesforce Data to Power AI Workflows.pptx
Dele Amefo
 
Function & Procedure: Function Vs Procedure in PL/SQL
Shani Tiwari
 
From spreadsheets and delays to real-time control
SatishKumar2651
 
Technical-Careers-Roadmap-in-Software-Market.pdf
Hussein Ali
 
Ad

Partition Your (Apex) Trigger Logic Using Metadata

  • 1. Partition Your Trigger Logic Using Metadata Mitch Spano Application Engineer - Google @mitchspano
  • 2. 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 Website. 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. Statement under the Private Securities Litigation Reform Act of 1995 Forward-Looking Statement
  • 4. If you are an Architect... • Consider how this framework can enable your organization to grow and scale • Listen for strategies to better partition your application If you are a Developer... • Learn how a metadata driven trigger framework can allow you to deliver higher quality Apex code • Observe the techniques used to test Apex used in this project If you are a Manager... • Gain an understanding of the complexities of working in an Apex trigger • Imagine ways this could be used in a multiple team environment Intended Audience What should you take from this discussion?
  • 6. Many Automation Tools Relative Risk and Power Flow Process Builder Workflow No Automation Triggers Less Risk/Power More Risk/Power
  • 8. public class OpportunityTriggerHandler extends TriggerHandler { public override void beforeUpdate() { for(Opportunity o : (List<Opportunity>) Trigger.new) { // do something } } // override additional contexts as necessary } Existing Frameworks Separate Trigger from Logic
  • 9. public class OpportunityTriggerHandler extends TriggerHandler { public override void afterInsert() { this.handleWholesaleInsert((List<Opportunity>) Trigger.new); this.handleRetailInsert((List<Opportunity>) Trigger.new); } private void handleWholesaleInsert(List<Opportunity> newList) { for(Opportunity o : newList) { // do something } } private void handleRetailInsert(List<Opportunity> newList) { for(Opportunity o : newList) { // do something } } } Existing Frameworks Handlers Require Modification
  • 10. public class OpportunityTriggerHandler extends TriggerHandler { public override void afterInsert() { this.handleWholesaleInsert((List<Opportunity>) Trigger.new); this.handleRetailInsert((List<Opportunity>) Trigger.new); this.recalculateAccountValues((List<Opportunity>) Trigger.new); this.notifyAMEASales((List<Opportunity>) Trigger.new); this.setDefaultAccountType((List<Opportunity>) Trigger.new); this.defineOpportunityContactRoles((List<Opportunity>) Trigger.new); } private void handleWholesaleInsert(List<Opportunity> newList) { for(Opportunity o : newList) { // do something } } // More methods are implemented and called for every action :( } Existing Frameworks Becomes Unmaintainable
  • 11. Trigger Actions Framework A Metadata Driven Approach
  • 15. Work Together in Teams Strategies for Working in a Multiple-Team Environment
  • 16. Working in Multiple Teams New Package Directories { "packageDirectories": [ { "path": "application/base" }, { "path": "application/opportunity-automation" }, { "path": "application/retail" }, { "path": "application/wholesale", "default": true } ], "namespace": "", "sfdcLoginUrl": "https://login.salesforce.com", "sourceApiVersion": "50.0" }
  • 17. Working in Multiple Teams Use the Order Order__c: 2.071 Team Prefix Order
  • 18. Working in Multiple Teams Use the Order