#ForceAcademyLA
I fell in love with
clicks AND code
… here’s what I learned
in relationship therapy
#ForceAcademyLA
Thank you Sponsors!
A big shout out to our sponsors, without them these events would
not be possible:
#ForceAcademyLA#ForceAcademyLA
Hello!
Daniel Stange
Technical Architect
DIA die.interaktiven
Frankfurt (DE) User Group Leader
Found Salesforce boring in the dark ages -
Changed my mind.
You can find me at:
@stangomat
linkedin.com/in/danielstange/
Blog: blog.danielstange.de
#ForceAcademyLA#ForceAcademyLA
• Happy (Solo) Days
• Relationship <3
• Crisis!
• Reconciliation
Agenda
#ForceAcademyLA
“Do not swear by the moon,
for she changes constantly.
then your love would also change.”
#ForceAcademyLA
Solo Admin,
flyin’ solo
1.
HAPPY
DAYS
#ForceAcademyLA#ForceAcademyLA
DEMO
Our session
scenario: Just a plain
org with some basic
“clicks not code”
automations
Place your screenshot here
#ForceAcademyLA
Wouldn‘t it be nice
if it never rained?
#ForceAcademyLA#ForceAcademyLA
Which scenarios
were tested?
There aren‘t any issues, right?
How was it tested?
For which scale
was it built?
Operation Types
Data Volume
#ForceAcademyLA
Admin <3 Dev
kinda…
2.
RELATIONSHIP
#ForceAcademyLA#ForceAcademyLA
• Apex Developers
• AppExchange Packages
• Integrations & Data Loads
• ... and even yourself (yes, that‘s right)
Who‘s in the game?
#ForceAcademyLA#ForceAcademyLA
Scenarios?
Again...
Tests?
Scale? Operations?
Data Volume?
Single record, positive tests from the UI with
an Admin user...
#ForceAcademyLA#ForceAcademyLA
DEMO
A new requirement!
And alas – it needs
some code!
Place your screenshot here
#ForceAcademyLA
“Thus with a kiss I die”
#ForceAcademyLA
„Just don‘t send these
kinds of emails!“
3.
CRISIS
#ForceAcademyLA#ForceAcademyLA
DEMO
Turns out that
declarative and code
don’t live side by
side harmonically…
But why?
And What can we
do?
Place your screenshot here
#ForceAcademyLA#ForceAcademyLA
• „it‘s nothing personal“ indeed:
Exceptions pop up as they happen
• Team up
• Keep documentation (of the system AND of
incidents)
Cope with Anger & Frustration
#ForceAcademyLA#ForceAcademyLA
LIMITS
Bring the attention of your audience over a
key concept using icons or illustrations
#ForceAcademyLA
Everyone shares the same set of limits
Even workflow rules consume governor
limits.
Database interactions, rows...
And CPU time!
KNOW ABOUT THE LIMITS
#ForceAcademyLA#ForceAcademyLA
ORDER
There’s an order to everything that
happens after you saved a record to the
database
#ForceAcademyLA#ForceAcademyLA
Know the „Order of Execution“ by heart
Þ Core explanation for most common problems
Þ Logic may not run (or run more than once)
Þ Data may have changed
Þ Inspect the operation flow in the dev console
using the „Analysis Perspective“
#ForceAcademyLA#ForceAcademyLA
„Order of Execution“ at a glance
#ForceAcademyLA#ForceAcademyLA
„Order of Execution“ at a glance
#ForceAcademyLA#ForceAcademyLA
„Order of Execution“ at a glance
#ForceAcademyLA#ForceAcademyLA
RECURSION
Re-Entry into previously executed logic
is sometimes crucial – and sometimes
terribly dangerous
#ForceAcademyLA#ForceAcademyLA
Operations can (and will) run in circles
Recursion is the #1 villain... Really.
Use the recursion flags
for Workflows and
process Builder with care
Map out your operations
#ForceAcademyLA#ForceAcademyLA
SPREAD
A Change in Data can trigger a chain
reaction as it fires logic far away from the
starting point
#ForceAcademyLA#ForceAcademyLA
Operations tend to spread out
Plan automations carefully if they are going to touch
related objects and keep documentation / maps.
#ForceAcademyLA#ForceAcademyLA
The Usual Suspects...
• Rollup Summaries
• Cross Object Workflow Updates
• Implicit Rollups
• (Task to LastActivityDate on Account and WhoId / WhatID)
• DLRS / Rollup Helper
#ForceAcademyLA#ForceAcademyLA
DEMO
Supposedly simple
operations can
consume a massive
amount of your
limits
Place your screenshot here
#ForceAcademyLA
They lived happily
Ever after
4.
RECONCILIATION
#ForceAcademyLA#ForceAcademyLA
CHOOSE
WISELY
Know when to build code,
know when to save the effort
#ForceAcademyLA#ForceAcademyLA
• Avoid PB / Flow for bulk operations
• Use the advantage of the „before“ context in
Triggers
• Use „update records“ action with care if
writing up or down
• Minimize the number of automation types
and stick with one
Rule of thumb: Least complex tool
to do the job
#ForceAcademyLA#ForceAcademyLA
BE
SPECIFIC
For every automation, check for the
conditions to really run the automation
#ForceAcademyLA#ForceAcademyLA
• Leverage entry criteria
• Leverage action criteria in Process Builder
• Check for Changed Fields before running
your logic
Filter for exact scenarios
#ForceAcademyLA#ForceAcademyLA
USE
GATES
Filter away everything
that should not happen
#ForceAcademyLA#ForceAcademyLA
• Use hidden fields to start or bypass
workflows, flows and process builder nodes
Flow Control in Declarative Logic
#ForceAcademyLA#ForceAcademyLA
Static variables to keep track of
• Operation Entry Point
• Executed Units
• Processed Record Ids
• Units to execute (or not)
Advanced stuff: Enterprise Patterns / Unit of
Work
Flow Control in Apex Triggers
#ForceAcademyLA#ForceAcademyLA
DEMO
Use clear entry
conditions and
prevent re-entry
Place your screenshot here
#ForceAcademyLA#ForceAcademyLA
ALLOW
BYPASSES
Once you control your automations, build
ways to bypass your logic
#ForceAcademyLA#ForceAcademyLA
Bypasses let you decide which logic to run next.
• Exceptions from Validations
• Deliberately bypass logic
KNOW WHAT YOU‘RE DOING:
Data Inconsistency Ahead!
Bypasses to manipulate the flow
#ForceAcademyLA#ForceAcademyLA
DEMO
Use a Custom
Permission to
Bypass Validations
Place your screenshot here
#ForceAcademyLA#ForceAcademyLA
DEMO
Use Handler
bypasses in Triggers
Place your screenshot here
#ForceAcademyLA#ForceAcademyLA
The Work Horse:
Kevin O‘Hara‘s Framework:
github.com/kevinohara80/sfdc-trigger-framework
Lightweight & Modern:
MyTriggers: github.com/appero-com/MyTriggers
Full Circle:
Force DI: github.com/afawcett/force-di
Trigger Handler Progression
#ForceAcademyLA#ForceAcademyLA
TEST,
TEST,
TEST… volume, integrations, expected outcome,
#ForceAcademyLA#ForceAcademyLA
DEMO
Example of a test
data insert, update
extract and delete
job.
Place your screenshot here
#ForceAcademyLA#ForceAcademyLA
Thank Y u!
Any questions?
You can find me at:
@stangomat
Daniel.Stange@die-interaktiven.de
linkedin.com/in/danielstange/
Blog post / source code to come
blog.danielstange.de and github.com/dstdia

Force Academy '19: I fell in love with clicks AND code - here's what I learned in relationship therapy