SlideShare a Scribd company logo
Advanced Flow Techniques with
Apex and Visualforce
​ Damien Phillippi
​ Software Developer
​ dphillippi@soliantconsulting.com
​ damienphillippi@gmail.com
​ 
•  What are Visual Workflows and when should I use it?
•  How to combine with code.
•  Code Samples
Overview
What is Visual
Workflow?
Software Developer, Soliant Consulting
Visual Flows
Triggered by User operation
Visual and interactive
Can effect or be effected by multiple objects
Drag and drop interface
Headless Flows can trigger events as well
Restricted by governor limits
Workflows
Triggered by events
Behind the scenes
Executes on specific objects
Create Static processes
What Makes Visual Workflows different?
In short, you generally want to use Visual WorkFlows when you have a
requirement similar to traditional workflows but it requires some sort of User
interaction.
For those not yet familiar with Visual Workflow:
https://developer.salesforce.com/trailhead/
business_process_automation/flow
•  Create a survey that can change frequently over time
•  Create a streamlined Case creation process for your org
•  Quickly create a set of related children for a record
•  Create a set of questions to follow along for a call center to give
standardized scripts for the User
•  Replace some Apex Utility Triggers with Headless Flows
•  https://developer.salesforce.com/trailhead/
business_process_automation/process_whichtool
Visual Workflow Use Cases
Breakdown Point
Flows tend to break down when you need to get more dynamic past the
User interaction piece.
In my presentation, I will be showing you 2 such examples.
1)  You want to run a SOSL or dynamic query rather than a static query on
an object.
2)  You might want to dynamically route your User or do different
operations depending on earlier actions in your flow.
Code with Visual Workflows
Enhance your Flow with code
Adding code helps strengthen Flows
•  Dynamic query filters
•  SOSL queries
•  Dynamic routing
Our First goal
Create a way to search the database for matches in both Leads and
Contacts.
Create a global class with the @InvocableMethod in it
Put a Simple Flow in a Visualforce Page that uses the
Invocable class
that was just created.
DF_Presentation.flow
DFPresentation.page
Query Demo
Add Error Handling
What happens when more than a single record is returned?
DF_Presentation.flow updated
Error Handling Demo
Dynamic Record Routing
Do we want to do something different if a Lead is found vs a Contact? Maybe we
decide that any Leads coming through this route should immediately be
converted and Contacts should be taken to their view page.
This looks like it should work…
Unfortunately, this doesn’t work. The reason is that it fetches
redirectUser as a property/variable. The method would need to be
called getRedirectUser, but when it actually gets called it wouldn’t
know about the flow variables yet by that point.
Adjustments to the controller
Updated VF page to work around the System
Routing Demo
Why not just use code?
•  Any changes to functionality require adjustments to unit tests and
deployments through Sandboxes
•  Configurable by an Admin
Closing
In this 25 min, we showed you an example of some of the things you can
do when you combine code/Visual Workflow.
•  Invoke code from Visual Workflows
•  Error handling.
•  Dynamic record routing
•  Alternate code with Flows:
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/
apexcode/apex_process_plugin_using.htm
•  Code can be found at: http://tinyurl.com/q92s6y9
•  Questions?
Over the past ten years, our team
has helped shape our clients’
futures as well as served to simply
make their business lives easier.
Our role extends well beyond
being experts in creating custom
software – we consider ourselves
your trusted business partner.
IMPLEMENTATION
As process consultants, we assist adoption by
focusing on how your team works day-to-day.
APEX & VISUALFORCE
Our versatile, experienced team has a deep
understanding of Salesforce’s native languages.
APPEXCHANGE DEVELOPMENT
We develop AppExchange solutions and navigate
the Salesforce security review process.
SYSTEMS INTEGRATION
Salesforce can seamlessly integrate with your
existing business applications and IT
infrastructure.

More Related Content

PDF
Building Dynamic UI with Visual Workflow Runtime API
PDF
A Developer's Guide to Visual Workflow
PPTX
SFDC Visual Flow
PDF
Visual Workflow Overview
PPTX
Go with the Flow: Automating Business Processes with Clicks
PPTX
Cloud flow designer: Salesforce.com
PPTX
Automate Processes Visually with the Lightning Process Builder
PPTX
Process Automation on Lightning Platform Workshop
Building Dynamic UI with Visual Workflow Runtime API
A Developer's Guide to Visual Workflow
SFDC Visual Flow
Visual Workflow Overview
Go with the Flow: Automating Business Processes with Clicks
Cloud flow designer: Salesforce.com
Automate Processes Visually with the Lightning Process Builder
Process Automation on Lightning Platform Workshop

What's hot (20)

PDF
Salesforce.com API Series: Service Cloud Console Deep Dive
PPTX
Practical Headless Flow Examples
PDF
A Pocket Guide to Process Builder, Flows, and Triggers
PDF
Salesforce API: Salesforce Console Deep Dive
PPTX
Secure Development on the Salesforce Platform - Part 2
PDF
Code live with Brian Kwong - Visualforce to Lwc
PDF
ISV Lightning Webinar Series - Part 1 (December 1, 2015)
PDF
Planning Your Migration to the Lightning Experience
PDF
AppExchange Tech Enablement June 2017
PDF
Lightning Design System and Components for Visualforce Developers
PDF
ISV Monthly Tech Enablement (May 18, 2017)
PPTX
Migrating Visualforce Pages to Lightning
PDF
Write bulletproof trigger code
PDF
Webinar Coding for Salesforce Admins
PDF
Build Smarter Apps with Einstein Object Detection
PDF
Salesforce University - Guide to Certification Paths
PPTX
Salesforce Lightning component framework from 0 to app
PPTX
Getting Ready for Ligtning Process Builder
PDF
Lightning web components episode 2- work with salesforce data
PPTX
Snap-in Service to Web and Mobile Apps
Salesforce.com API Series: Service Cloud Console Deep Dive
Practical Headless Flow Examples
A Pocket Guide to Process Builder, Flows, and Triggers
Salesforce API: Salesforce Console Deep Dive
Secure Development on the Salesforce Platform - Part 2
Code live with Brian Kwong - Visualforce to Lwc
ISV Lightning Webinar Series - Part 1 (December 1, 2015)
Planning Your Migration to the Lightning Experience
AppExchange Tech Enablement June 2017
Lightning Design System and Components for Visualforce Developers
ISV Monthly Tech Enablement (May 18, 2017)
Migrating Visualforce Pages to Lightning
Write bulletproof trigger code
Webinar Coding for Salesforce Admins
Build Smarter Apps with Einstein Object Detection
Salesforce University - Guide to Certification Paths
Salesforce Lightning component framework from 0 to app
Getting Ready for Ligtning Process Builder
Lightning web components episode 2- work with salesforce data
Snap-in Service to Web and Mobile Apps
Ad

Similar to Advanced Flow Techniques with Apex and Visualforce (20)

PPTX
Salesforce Flows Architecture Best Practices
PDF
Know How to Flow - Kelly Hardebeck
PPTX
Talkin bout Flow - Meighan Brodkey WIT Devs
PPTX
Getting_Started_with_Salesforce_Flow_for_Developers_(In-person_event)_.pptx
PPTX
Salesforce Elevate - Bilbao '17 - Process automation with and without code
PDF
The Business of Flow - Point and Click Workflow Applications
PPTX
TrailblazerDX Motihari.pptx
PDF
Automate All The Things with Flow
PDF
Building Complex Traversing & Branching Apps Using Visual Workflows and Apex
PPTX
Flow Presentation vFINAL
PPTX
Why Flow with Salesforce Flow
PPTX
Getting to Flow You-Arkansas UG Nov 2022.pptx
PDF
Getting to Flow You: A First Date with Flow Builder
PDF
Rapid Solutions with Salesforce Flows
PPTX
Flows in the Service Console, Gotta Go with the Flow! by Duncan Stewart
PDF
Taking Flow to the Next Level with Just Enough Code
PPTX
Salesforce Flow using development with Gen. AI
PPTX
Use Microsoft Flow Connectors to create a powerful business process app
PDF
Visualforce Workbook
PDF
Advanced Uses of Salesforce's Login Flows
Salesforce Flows Architecture Best Practices
Know How to Flow - Kelly Hardebeck
Talkin bout Flow - Meighan Brodkey WIT Devs
Getting_Started_with_Salesforce_Flow_for_Developers_(In-person_event)_.pptx
Salesforce Elevate - Bilbao '17 - Process automation with and without code
The Business of Flow - Point and Click Workflow Applications
TrailblazerDX Motihari.pptx
Automate All The Things with Flow
Building Complex Traversing & Branching Apps Using Visual Workflows and Apex
Flow Presentation vFINAL
Why Flow with Salesforce Flow
Getting to Flow You-Arkansas UG Nov 2022.pptx
Getting to Flow You: A First Date with Flow Builder
Rapid Solutions with Salesforce Flows
Flows in the Service Console, Gotta Go with the Flow! by Duncan Stewart
Taking Flow to the Next Level with Just Enough Code
Salesforce Flow using development with Gen. AI
Use Microsoft Flow Connectors to create a powerful business process app
Visualforce Workbook
Advanced Uses of Salesforce's Login Flows
Ad

More from Salesforce Developers (20)

PDF
Sample Gallery: Reference Code and Best Practices for Salesforce Developers
PDF
Maximizing Salesforce Lightning Experience and Lightning Component Performance
PDF
Local development with Open Source Base Components
PPTX
TrailheaDX India : Developer Highlights
PDF
Why developers shouldn’t miss TrailheaDX India
PPTX
CodeLive: Build Lightning Web Components faster with Local Development
PPTX
CodeLive: Converting Aura Components to Lightning Web Components
PPTX
Enterprise-grade UI with open source Lightning Web Components
PPTX
TrailheaDX and Summer '19: Developer Highlights
PDF
Live coding with LWC
PDF
Lightning web components - Episode 4 : Security and Testing
PDF
LWC Episode 3- Component Communication and Aura Interoperability
PDF
Lightning web components - Episode 1 - An Introduction
PDF
Migrating CPQ to Advanced Calculator and JSQCP
PDF
Scale with Large Data Volumes and Big Objects in Salesforce
PDF
Replicate Salesforce Data in Real Time with Change Data Capture
PDF
Modern Development with Salesforce DX
PDF
Get Into Lightning Flow Development
PDF
Integrate CMS Content Into Lightning Communities with CMS Connect
PDF
Introduction to MuleSoft
Sample Gallery: Reference Code and Best Practices for Salesforce Developers
Maximizing Salesforce Lightning Experience and Lightning Component Performance
Local development with Open Source Base Components
TrailheaDX India : Developer Highlights
Why developers shouldn’t miss TrailheaDX India
CodeLive: Build Lightning Web Components faster with Local Development
CodeLive: Converting Aura Components to Lightning Web Components
Enterprise-grade UI with open source Lightning Web Components
TrailheaDX and Summer '19: Developer Highlights
Live coding with LWC
Lightning web components - Episode 4 : Security and Testing
LWC Episode 3- Component Communication and Aura Interoperability
Lightning web components - Episode 1 - An Introduction
Migrating CPQ to Advanced Calculator and JSQCP
Scale with Large Data Volumes and Big Objects in Salesforce
Replicate Salesforce Data in Real Time with Change Data Capture
Modern Development with Salesforce DX
Get Into Lightning Flow Development
Integrate CMS Content Into Lightning Communities with CMS Connect
Introduction to MuleSoft

Recently uploaded (20)

PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Empathic Computing: Creating Shared Understanding
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
NewMind AI Monthly Chronicles - July 2025
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PPTX
Big Data Technologies - Introduction.pptx
DOCX
The AUB Centre for AI in Media Proposal.docx
PPT
Teaching material agriculture food technology
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Modernizing your data center with Dell and AMD
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PDF
Machine learning based COVID-19 study performance prediction
PDF
Approach and Philosophy of On baking technology
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
NewMind AI Weekly Chronicles - August'25 Week I
Empathic Computing: Creating Shared Understanding
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
NewMind AI Monthly Chronicles - July 2025
“AI and Expert System Decision Support & Business Intelligence Systems”
Big Data Technologies - Introduction.pptx
The AUB Centre for AI in Media Proposal.docx
Teaching material agriculture food technology
Network Security Unit 5.pdf for BCA BBA.
Modernizing your data center with Dell and AMD
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Machine learning based COVID-19 study performance prediction
Approach and Philosophy of On baking technology
Chapter 3 Spatial Domain Image Processing.pdf
Per capita expenditure prediction using model stacking based on satellite ima...
Digital-Transformation-Roadmap-for-Companies.pptx
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf

Advanced Flow Techniques with Apex and Visualforce

  • 1. Advanced Flow Techniques with Apex and Visualforce ​ Damien Phillippi ​ Software Developer ​ dphillippi@soliantconsulting.com ​ damienphillippi@gmail.com ​ 
  • 2. •  What are Visual Workflows and when should I use it? •  How to combine with code. •  Code Samples Overview
  • 3. What is Visual Workflow? Software Developer, Soliant Consulting
  • 4. Visual Flows Triggered by User operation Visual and interactive Can effect or be effected by multiple objects Drag and drop interface Headless Flows can trigger events as well Restricted by governor limits Workflows Triggered by events Behind the scenes Executes on specific objects Create Static processes What Makes Visual Workflows different? In short, you generally want to use Visual WorkFlows when you have a requirement similar to traditional workflows but it requires some sort of User interaction. For those not yet familiar with Visual Workflow: https://developer.salesforce.com/trailhead/ business_process_automation/flow
  • 5. •  Create a survey that can change frequently over time •  Create a streamlined Case creation process for your org •  Quickly create a set of related children for a record •  Create a set of questions to follow along for a call center to give standardized scripts for the User •  Replace some Apex Utility Triggers with Headless Flows •  https://developer.salesforce.com/trailhead/ business_process_automation/process_whichtool Visual Workflow Use Cases
  • 6. Breakdown Point Flows tend to break down when you need to get more dynamic past the User interaction piece. In my presentation, I will be showing you 2 such examples. 1)  You want to run a SOSL or dynamic query rather than a static query on an object. 2)  You might want to dynamically route your User or do different operations depending on earlier actions in your flow.
  • 7. Code with Visual Workflows Enhance your Flow with code
  • 8. Adding code helps strengthen Flows •  Dynamic query filters •  SOSL queries •  Dynamic routing Our First goal Create a way to search the database for matches in both Leads and Contacts.
  • 9. Create a global class with the @InvocableMethod in it
  • 10. Put a Simple Flow in a Visualforce Page that uses the Invocable class that was just created. DF_Presentation.flow DFPresentation.page
  • 12. Add Error Handling What happens when more than a single record is returned? DF_Presentation.flow updated
  • 14. Dynamic Record Routing Do we want to do something different if a Lead is found vs a Contact? Maybe we decide that any Leads coming through this route should immediately be converted and Contacts should be taken to their view page.
  • 15. This looks like it should work… Unfortunately, this doesn’t work. The reason is that it fetches redirectUser as a property/variable. The method would need to be called getRedirectUser, but when it actually gets called it wouldn’t know about the flow variables yet by that point.
  • 16. Adjustments to the controller
  • 17. Updated VF page to work around the System
  • 19. Why not just use code? •  Any changes to functionality require adjustments to unit tests and deployments through Sandboxes •  Configurable by an Admin
  • 20. Closing In this 25 min, we showed you an example of some of the things you can do when you combine code/Visual Workflow. •  Invoke code from Visual Workflows •  Error handling. •  Dynamic record routing •  Alternate code with Flows: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/ apexcode/apex_process_plugin_using.htm •  Code can be found at: http://tinyurl.com/q92s6y9 •  Questions?
  • 21. Over the past ten years, our team has helped shape our clients’ futures as well as served to simply make their business lives easier. Our role extends well beyond being experts in creating custom software – we consider ourselves your trusted business partner. IMPLEMENTATION As process consultants, we assist adoption by focusing on how your team works day-to-day. APEX & VISUALFORCE Our versatile, experienced team has a deep understanding of Salesforce’s native languages. APPEXCHANGE DEVELOPMENT We develop AppExchange solutions and navigate the Salesforce security review process. SYSTEMS INTEGRATION Salesforce can seamlessly integrate with your existing business applications and IT infrastructure.