SlideShare a Scribd company logo
The “Event Turnstile” Pattern: A #FlowFirst
approach that will turbocharge your Flows and let
you use Flow for many more challenges without
having to use Apex
Break Record Limits with
Recursive Flows.
(a.k.a. Recursive Flows)
Accenture
Paul McCollum
paulmccollum@gmail.com
@uxaholic
https://trailblazer.me/id/pmccollum
LinkedIn:/in/realPaulMcCollum
(214) 642-7523
Technical Architect | Accenture
Stuff I do:
• 2017 Appventure Contest Winner
• 3x Dreamforce Speaker
• 2021 Dreamforce Attendee 
• UX Master Certified from NN/g
• SalesforceForYouth Leader
• Dallas Developer User Group Leader
Ask me about:
• JavaScript
• DIY Solar Power/Lithium Batteries
• Volleyball
You are about to learn how to use Flows in a way that can POSSIBLY create infinite loops.
Flow has been designed VERY SPECIFICALLY to prevent exactly this.
****Use at your own risk.****
If you break your org or your tenant, remember: You DON’T KNOW ME!
This is your only warning.
The Problem:
What we did. What stopped us!
Something
starts our Flow
CPU
time
Iteration
#
Memory
Size
Error
Transactions can only run for so many* seconds
before the SF engine kills the process.
Flows have a maximum of 2000 “iterations” before
they error out.
Flows and query data can only contain or save
‘state’ with so much* data or it errors out.
* See governor limits. Vague ‘so’ given here as limits change.
Pause?
Sub-flow?
Transaction
Governor Limits
Who needs to know this stuff
I love flows and I hate limits,
tell me the cheat codes!!!
I’m learning Flows but I’ve
never tried to use them for
anything “Big”.
I’m going to show the unique
part of the approach first….
And then go through all the
pieces that make up how the
whole thing works.
Update Records
(YOUR PURPOSE)
Basic Flow
Something
starts our Flow
Get Records
Loop over
Records
Build an Update
Collection
THEN
Transaction
Update Records
(YOUR PURPOSE)
Another Perspective: New Pattern
Something
starts our Flow
Event Triggered
Flow
Get Records
(non-tagged)
Loop over
Records
Record Records
(for tagging)
Build an Update
Collection
Update Records
(for tagging)
Count Until
“MaxLoop”
Write
ANOTHER
Event
THEN
Transaction
Transaction
The
Magic
Event
Developer Concepts used to attack the problem.
It’s as easy as 1, 2 , 3 …
1. Shaping the record size that our flows will process per run.
1. Plan before you build. Know your relative data sizes.
2. Saving our progress on incomplete runs.
3. Creating and Using “Platform Events” to trigger flows.
Step 1: Size your data
Step 1: Plan Data Sizes:
Limbo under the limits per Flow instance.
Under 50k Records
“Get Records”
Under 2k Iterations
“Flow Elements”
Under (2k ÷ Elements)
“Loops”
Steps
• Most parts of a flow, count as iterations.
Flows currently have a 2000 iteration
limit.
CPU time
• If a transaction takes too long to finish,
you will get a CPU time error.
Memory
• To ‘pause’ a process, all the memory
(records, variables, values) must be
saved for later. Too much data = error.
Flow Limits (basics)
Flows
Steps, Loops and Transactions
In this Flow:
• There are 3 One-time iterations (actions).
• And 3 one per record (Loop) iterations (actions).
Flows can have a maximum of 2000 iterations per run.
Iterations are Special Steps in a flow.
Once per Flow Once per Flow
Once per RECORD
Flows
Steps, Loops and Transactions
To calculate Iteration limits:
• Multiply the number of Loop actions.
• Add the number of 1-time actions
• Then Divide 2000 by that number.
Once per Flow Once per Flow
Once per RECORD
2000 / (“Loop iterations”) - “1-time actions” = Max Loop Size
Flows
Steps, Loops and Transactions
Examples::
2 Loop actions = 2000/2 = 1000 records per Flow.
5 Loop actions = 2000/5 = 400 records per Flow
20 Loop actions = 2000/20 = 100 records per Flow
Flows can have a maximum of 2000 iterations per run.
Iterations are Special Steps in a flow.
Once per Flow Once per Flow
Once per RECORD
2000 / (“Loop iterations”) - “1-time actions” = Max Loop Size
Examples:
2 LA + 10 SA = 2000/2-10 = 990 records per Flow.
5 LA + 10 SA = 2000/5 -10 = 390 records per Flow
20 LA + 10 SA = 2000/20 -10 = 90 records per Flow
SA = Single (one time) Action
LA = Loop (repeated) Action
Step 2: Counting, Saving and Resuming
Step 2: Counting, Saving and Resuming
Remember: Maximum “Get Records” Size = 50k
Be aware of indexes.
Batch Tracking:
Create a field on your target object that you can ‘mark’ as done for each batch.
If your process runs daily, make it a Date Field.
If your process runs Monthly, make it a Date Field.
If it runs for anything else, give it a name that’s going to be different the next time it runs.
But usually ‘date’ is a good batch label.
THEN
Marking your place:
You need to have several tracking variables in your head AND YOUR FLOW to make this work.
• Max Loops
• Max Runs
• Field in your recordset to mark complete on this “Run”.
- e.g., Date/Event/Time/Reporting Period
Each time you finish a batch run, update the records you’ve processed with the batch label in your new batch field.
Count Loops and Save Progress
Step 3: Flow: Creating Events
Step 3: Flow: Creating Events
They don’t seem special, but they really are.
Created Different but otherwise just like an object, field and records.
Except you can’t query them, so testing can be ‘fun’.
Creating an Event is the same as Create a Record
Update Records
(YOUR PURPOSE)
Assembling the parts
Something
starts our Flow
Event Triggered
Flow
Get Records
(non-tagged)
Loop over
Records
Record Records
(for tagging)
Build Update
Collection
Update Records
(for tagging)
Count Until
“MaxLoop”
Write
Event
Write
ANOTHER
Event
THEN
One Flow becomes Two
Talk through the Flow parts
Does the Work
Starts The Process
Preps for the next run
Walk through the working Flow Builder
Gives with 1 hand and takes with all the others.
Gotta Go ‘Old School’ on debugging
Gotta go old school on debugging.
Advanced Concepts
Outer Loops for MOAR records
-Sizing your data to fit under the hurdles
Safety Counters
Managing Multiple Flows with the same Event Object
-”Flow Turnstile Event Object” vs. “Thing that Recursively does this one flow”.
Questions?
Thank You!!
Pattern
TriggerEvent then Flow (+create Event) then Event (repeat)
New Event
starts Main Flow
Write
Event
Write
Event
Something
starts our Flow
Transaction
Transaction
OR

More Related Content

Similar to Supercharge Flows for thousands of records with Platform Events

Snowplow Analytics: from NoSQL to SQL and back again
Snowplow Analytics: from NoSQL to SQL and back againSnowplow Analytics: from NoSQL to SQL and back again
Snowplow Analytics: from NoSQL to SQL and back again
Alexander Dean
 
Cashing in on logging and exception data
Cashing in on logging and exception dataCashing in on logging and exception data
Cashing in on logging and exception data
Stackify
 
Capacity Management from Flickr
Capacity Management from FlickrCapacity Management from Flickr
Capacity Management from Flickrxlight
 
Cross-platform logging and analytics
Cross-platform logging and analyticsCross-platform logging and analytics
Cross-platform logging and analytics
Drew Crawford
 
Spark + AI Summit 2019: Apache Spark Listeners: A Crash Course in Fast, Easy ...
Spark + AI Summit 2019: Apache Spark Listeners: A Crash Course in Fast, Easy ...Spark + AI Summit 2019: Apache Spark Listeners: A Crash Course in Fast, Easy ...
Spark + AI Summit 2019: Apache Spark Listeners: A Crash Course in Fast, Easy ...
Landon Robinson
 
About time
About timeAbout time
About time
Nadav Wiener
 
Elk scilifelab
Elk scilifelabElk scilifelab
Playground 11022017 user_monitoring
Playground 11022017 user_monitoringPlayground 11022017 user_monitoring
Playground 11022017 user_monitoring
Matthijs Mali
 
Stress Testing at Twitter: a tale of New Year Eves
Stress Testing at Twitter: a tale of New Year EvesStress Testing at Twitter: a tale of New Year Eves
Stress Testing at Twitter: a tale of New Year Eves
Herval Freire
 
Apache Spark Listeners: A Crash Course in Fast, Easy Monitoring
Apache Spark Listeners: A Crash Course in Fast, Easy MonitoringApache Spark Listeners: A Crash Course in Fast, Easy Monitoring
Apache Spark Listeners: A Crash Course in Fast, Easy Monitoring
Databricks
 
Flink Forward San Francisco 2019: Real-time Processing with Flink for Machine...
Flink Forward San Francisco 2019: Real-time Processing with Flink for Machine...Flink Forward San Francisco 2019: Real-time Processing with Flink for Machine...
Flink Forward San Francisco 2019: Real-time Processing with Flink for Machine...
Flink Forward
 
The rice and fail of an IoT solution
The rice and fail of an IoT solutionThe rice and fail of an IoT solution
The rice and fail of an IoT solution
Radu Vunvulea
 
Social Connections VI Prague - An introduction to ibm connections as an appde...
Social Connections VI Prague - An introduction to ibm connections as an appde...Social Connections VI Prague - An introduction to ibm connections as an appde...
Social Connections VI Prague - An introduction to ibm connections as an appde...
Mikkel Flindt Heisterberg
 
The Incremental Path to Observability
The Incremental Path to ObservabilityThe Incremental Path to Observability
The Incremental Path to Observability
Emily Nakashima
 
Scaling an ELK stack at bol.com
Scaling an ELK stack at bol.comScaling an ELK stack at bol.com
Scaling an ELK stack at bol.com
Renzo Tomà
 
Real-Time Event Processing
Real-Time Event ProcessingReal-Time Event Processing
Real-Time Event Processing
Amazon Web Services
 
Span Conference: Why your company needs a unified log
Span Conference: Why your company needs a unified logSpan Conference: Why your company needs a unified log
Span Conference: Why your company needs a unified log
Alexander Dean
 
Elastic Data Analytics Platform @Datadog
Elastic Data Analytics Platform @DatadogElastic Data Analytics Platform @Datadog
Elastic Data Analytics Platform @Datadog
C4Media
 
JavaOne 2015: Top Performance Patterns Deep Dive
JavaOne 2015: Top Performance Patterns Deep DiveJavaOne 2015: Top Performance Patterns Deep Dive
JavaOne 2015: Top Performance Patterns Deep Dive
Andreas Grabner
 
System insight without Interference
System insight without InterferenceSystem insight without Interference
System insight without Interference
Tony Tam
 

Similar to Supercharge Flows for thousands of records with Platform Events (20)

Snowplow Analytics: from NoSQL to SQL and back again
Snowplow Analytics: from NoSQL to SQL and back againSnowplow Analytics: from NoSQL to SQL and back again
Snowplow Analytics: from NoSQL to SQL and back again
 
Cashing in on logging and exception data
Cashing in on logging and exception dataCashing in on logging and exception data
Cashing in on logging and exception data
 
Capacity Management from Flickr
Capacity Management from FlickrCapacity Management from Flickr
Capacity Management from Flickr
 
Cross-platform logging and analytics
Cross-platform logging and analyticsCross-platform logging and analytics
Cross-platform logging and analytics
 
Spark + AI Summit 2019: Apache Spark Listeners: A Crash Course in Fast, Easy ...
Spark + AI Summit 2019: Apache Spark Listeners: A Crash Course in Fast, Easy ...Spark + AI Summit 2019: Apache Spark Listeners: A Crash Course in Fast, Easy ...
Spark + AI Summit 2019: Apache Spark Listeners: A Crash Course in Fast, Easy ...
 
About time
About timeAbout time
About time
 
Elk scilifelab
Elk scilifelabElk scilifelab
Elk scilifelab
 
Playground 11022017 user_monitoring
Playground 11022017 user_monitoringPlayground 11022017 user_monitoring
Playground 11022017 user_monitoring
 
Stress Testing at Twitter: a tale of New Year Eves
Stress Testing at Twitter: a tale of New Year EvesStress Testing at Twitter: a tale of New Year Eves
Stress Testing at Twitter: a tale of New Year Eves
 
Apache Spark Listeners: A Crash Course in Fast, Easy Monitoring
Apache Spark Listeners: A Crash Course in Fast, Easy MonitoringApache Spark Listeners: A Crash Course in Fast, Easy Monitoring
Apache Spark Listeners: A Crash Course in Fast, Easy Monitoring
 
Flink Forward San Francisco 2019: Real-time Processing with Flink for Machine...
Flink Forward San Francisco 2019: Real-time Processing with Flink for Machine...Flink Forward San Francisco 2019: Real-time Processing with Flink for Machine...
Flink Forward San Francisco 2019: Real-time Processing with Flink for Machine...
 
The rice and fail of an IoT solution
The rice and fail of an IoT solutionThe rice and fail of an IoT solution
The rice and fail of an IoT solution
 
Social Connections VI Prague - An introduction to ibm connections as an appde...
Social Connections VI Prague - An introduction to ibm connections as an appde...Social Connections VI Prague - An introduction to ibm connections as an appde...
Social Connections VI Prague - An introduction to ibm connections as an appde...
 
The Incremental Path to Observability
The Incremental Path to ObservabilityThe Incremental Path to Observability
The Incremental Path to Observability
 
Scaling an ELK stack at bol.com
Scaling an ELK stack at bol.comScaling an ELK stack at bol.com
Scaling an ELK stack at bol.com
 
Real-Time Event Processing
Real-Time Event ProcessingReal-Time Event Processing
Real-Time Event Processing
 
Span Conference: Why your company needs a unified log
Span Conference: Why your company needs a unified logSpan Conference: Why your company needs a unified log
Span Conference: Why your company needs a unified log
 
Elastic Data Analytics Platform @Datadog
Elastic Data Analytics Platform @DatadogElastic Data Analytics Platform @Datadog
Elastic Data Analytics Platform @Datadog
 
JavaOne 2015: Top Performance Patterns Deep Dive
JavaOne 2015: Top Performance Patterns Deep DiveJavaOne 2015: Top Performance Patterns Deep Dive
JavaOne 2015: Top Performance Patterns Deep Dive
 
System insight without Interference
System insight without InterferenceSystem insight without Interference
System insight without Interference
 

More from sonumanoj

Industry Specific Solutions for a Customized World: Manufacturing and TDX22 R...
Industry Specific Solutions for a Customized World: Manufacturing and TDX22 R...Industry Specific Solutions for a Customized World: Manufacturing and TDX22 R...
Industry Specific Solutions for a Customized World: Manufacturing and TDX22 R...
sonumanoj
 
Getting started with Marketing Cloud
Getting started with Marketing CloudGetting started with Marketing Cloud
Getting started with Marketing Cloud
sonumanoj
 
Getting to Flow You: A First Date with Flow Builder
Getting to Flow You: A First Date with Flow BuilderGetting to Flow You: A First Date with Flow Builder
Getting to Flow You: A First Date with Flow Builder
sonumanoj
 
Salesforce Agile Methodology and Tools
Salesforce Agile Methodology and ToolsSalesforce Agile Methodology and Tools
Salesforce Agile Methodology and Tools
sonumanoj
 
MH Trailblazer Group - Understanding SSO Solution for Salesforce
MH Trailblazer Group - Understanding SSO Solution for SalesforceMH Trailblazer Group - Understanding SSO Solution for Salesforce
MH Trailblazer Group - Understanding SSO Solution for Salesforce
sonumanoj
 
Dreamforce Global Gathering (Admin)
Dreamforce Global Gathering (Admin)Dreamforce Global Gathering (Admin)
Dreamforce Global Gathering (Admin)
sonumanoj
 
Implementing Vanilla Web Components
Implementing Vanilla Web ComponentsImplementing Vanilla Web Components
Implementing Vanilla Web Components
sonumanoj
 
May-MH-TrailblazerEvent
May-MH-TrailblazerEventMay-MH-TrailblazerEvent
May-MH-TrailblazerEvent
sonumanoj
 

More from sonumanoj (8)

Industry Specific Solutions for a Customized World: Manufacturing and TDX22 R...
Industry Specific Solutions for a Customized World: Manufacturing and TDX22 R...Industry Specific Solutions for a Customized World: Manufacturing and TDX22 R...
Industry Specific Solutions for a Customized World: Manufacturing and TDX22 R...
 
Getting started with Marketing Cloud
Getting started with Marketing CloudGetting started with Marketing Cloud
Getting started with Marketing Cloud
 
Getting to Flow You: A First Date with Flow Builder
Getting to Flow You: A First Date with Flow BuilderGetting to Flow You: A First Date with Flow Builder
Getting to Flow You: A First Date with Flow Builder
 
Salesforce Agile Methodology and Tools
Salesforce Agile Methodology and ToolsSalesforce Agile Methodology and Tools
Salesforce Agile Methodology and Tools
 
MH Trailblazer Group - Understanding SSO Solution for Salesforce
MH Trailblazer Group - Understanding SSO Solution for SalesforceMH Trailblazer Group - Understanding SSO Solution for Salesforce
MH Trailblazer Group - Understanding SSO Solution for Salesforce
 
Dreamforce Global Gathering (Admin)
Dreamforce Global Gathering (Admin)Dreamforce Global Gathering (Admin)
Dreamforce Global Gathering (Admin)
 
Implementing Vanilla Web Components
Implementing Vanilla Web ComponentsImplementing Vanilla Web Components
Implementing Vanilla Web Components
 
May-MH-TrailblazerEvent
May-MH-TrailblazerEventMay-MH-TrailblazerEvent
May-MH-TrailblazerEvent
 

Recently uploaded

Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
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
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
DianaGray10
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Tobias Schneck
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
RTTS
 
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
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
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
 
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
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
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
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
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
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Ramesh Iyer
 
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
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
Abida Shariff
 
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
 

Recently uploaded (20)

Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
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
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 
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
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
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...
 
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*
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
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...
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
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...
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 
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
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
 
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
 

Supercharge Flows for thousands of records with Platform Events

  • 1. The “Event Turnstile” Pattern: A #FlowFirst approach that will turbocharge your Flows and let you use Flow for many more challenges without having to use Apex Break Record Limits with Recursive Flows. (a.k.a. Recursive Flows)
  • 2. Accenture Paul McCollum paulmccollum@gmail.com @uxaholic https://trailblazer.me/id/pmccollum LinkedIn:/in/realPaulMcCollum (214) 642-7523 Technical Architect | Accenture Stuff I do: • 2017 Appventure Contest Winner • 3x Dreamforce Speaker • 2021 Dreamforce Attendee  • UX Master Certified from NN/g • SalesforceForYouth Leader • Dallas Developer User Group Leader Ask me about: • JavaScript • DIY Solar Power/Lithium Batteries • Volleyball
  • 3. You are about to learn how to use Flows in a way that can POSSIBLY create infinite loops. Flow has been designed VERY SPECIFICALLY to prevent exactly this. ****Use at your own risk.**** If you break your org or your tenant, remember: You DON’T KNOW ME! This is your only warning.
  • 4. The Problem: What we did. What stopped us! Something starts our Flow CPU time Iteration # Memory Size Error Transactions can only run for so many* seconds before the SF engine kills the process. Flows have a maximum of 2000 “iterations” before they error out. Flows and query data can only contain or save ‘state’ with so much* data or it errors out. * See governor limits. Vague ‘so’ given here as limits change. Pause? Sub-flow? Transaction Governor Limits
  • 5. Who needs to know this stuff I love flows and I hate limits, tell me the cheat codes!!! I’m learning Flows but I’ve never tried to use them for anything “Big”. I’m going to show the unique part of the approach first…. And then go through all the pieces that make up how the whole thing works.
  • 6. Update Records (YOUR PURPOSE) Basic Flow Something starts our Flow Get Records Loop over Records Build an Update Collection THEN Transaction
  • 7. Update Records (YOUR PURPOSE) Another Perspective: New Pattern Something starts our Flow Event Triggered Flow Get Records (non-tagged) Loop over Records Record Records (for tagging) Build an Update Collection Update Records (for tagging) Count Until “MaxLoop” Write ANOTHER Event THEN Transaction Transaction The Magic Event
  • 8. Developer Concepts used to attack the problem. It’s as easy as 1, 2 , 3 … 1. Shaping the record size that our flows will process per run. 1. Plan before you build. Know your relative data sizes. 2. Saving our progress on incomplete runs. 3. Creating and Using “Platform Events” to trigger flows.
  • 9. Step 1: Size your data
  • 10. Step 1: Plan Data Sizes: Limbo under the limits per Flow instance. Under 50k Records “Get Records” Under 2k Iterations “Flow Elements” Under (2k ÷ Elements) “Loops”
  • 11. Steps • Most parts of a flow, count as iterations. Flows currently have a 2000 iteration limit. CPU time • If a transaction takes too long to finish, you will get a CPU time error. Memory • To ‘pause’ a process, all the memory (records, variables, values) must be saved for later. Too much data = error. Flow Limits (basics)
  • 12. Flows Steps, Loops and Transactions In this Flow: • There are 3 One-time iterations (actions). • And 3 one per record (Loop) iterations (actions). Flows can have a maximum of 2000 iterations per run. Iterations are Special Steps in a flow. Once per Flow Once per Flow Once per RECORD
  • 13. Flows Steps, Loops and Transactions To calculate Iteration limits: • Multiply the number of Loop actions. • Add the number of 1-time actions • Then Divide 2000 by that number. Once per Flow Once per Flow Once per RECORD 2000 / (“Loop iterations”) - “1-time actions” = Max Loop Size
  • 14. Flows Steps, Loops and Transactions Examples:: 2 Loop actions = 2000/2 = 1000 records per Flow. 5 Loop actions = 2000/5 = 400 records per Flow 20 Loop actions = 2000/20 = 100 records per Flow Flows can have a maximum of 2000 iterations per run. Iterations are Special Steps in a flow. Once per Flow Once per Flow Once per RECORD 2000 / (“Loop iterations”) - “1-time actions” = Max Loop Size Examples: 2 LA + 10 SA = 2000/2-10 = 990 records per Flow. 5 LA + 10 SA = 2000/5 -10 = 390 records per Flow 20 LA + 10 SA = 2000/20 -10 = 90 records per Flow SA = Single (one time) Action LA = Loop (repeated) Action
  • 15. Step 2: Counting, Saving and Resuming
  • 16. Step 2: Counting, Saving and Resuming Remember: Maximum “Get Records” Size = 50k Be aware of indexes. Batch Tracking: Create a field on your target object that you can ‘mark’ as done for each batch. If your process runs daily, make it a Date Field. If your process runs Monthly, make it a Date Field. If it runs for anything else, give it a name that’s going to be different the next time it runs. But usually ‘date’ is a good batch label. THEN Marking your place: You need to have several tracking variables in your head AND YOUR FLOW to make this work. • Max Loops • Max Runs • Field in your recordset to mark complete on this “Run”. - e.g., Date/Event/Time/Reporting Period Each time you finish a batch run, update the records you’ve processed with the batch label in your new batch field.
  • 17. Count Loops and Save Progress
  • 18. Step 3: Flow: Creating Events
  • 19. Step 3: Flow: Creating Events They don’t seem special, but they really are. Created Different but otherwise just like an object, field and records. Except you can’t query them, so testing can be ‘fun’.
  • 20. Creating an Event is the same as Create a Record
  • 21. Update Records (YOUR PURPOSE) Assembling the parts Something starts our Flow Event Triggered Flow Get Records (non-tagged) Loop over Records Record Records (for tagging) Build Update Collection Update Records (for tagging) Count Until “MaxLoop” Write Event Write ANOTHER Event THEN
  • 23. Talk through the Flow parts Does the Work Starts The Process Preps for the next run
  • 24. Walk through the working Flow Builder
  • 25. Gives with 1 hand and takes with all the others.
  • 26. Gotta Go ‘Old School’ on debugging
  • 27. Gotta go old school on debugging.
  • 28. Advanced Concepts Outer Loops for MOAR records -Sizing your data to fit under the hurdles Safety Counters Managing Multiple Flows with the same Event Object -”Flow Turnstile Event Object” vs. “Thing that Recursively does this one flow”.
  • 30.
  • 31. Pattern TriggerEvent then Flow (+create Event) then Event (repeat) New Event starts Main Flow Write Event Write Event Something starts our Flow Transaction Transaction OR

Editor's Notes

  1. Yep, I have seen that before, I care about what’s next….
  2. Oh, you just use an event to cheat? I get it, I’m gone. OR Sounds tricky. Show me the rest.
  3. Oh, you just use an event to cheat? I get it, I’m gone. OR Sounds tricky. Show me the rest.
  4. Oh, you just use an event to cheat? I get it, I’m gone. OR Sounds tricky. Show me the rest.
  5. https://resourceful-raccoon-388657-dev-ed.lightning.force.com/lightning/setup/EventObjects/home
  6. Oh, you just use an event to cheat? I get it, I’m gone. OR Sounds tricky. Show me the rest.
  7. Oh, you just use an event to cheat? I get it, I’m gone. OR Sounds tricky. Show me the rest.