Are you a developer who thinks Visual Workflow (aka Flow) is just for Admins? Join us to learn how to use Apex code and Visualforce to strengthen your Flows, while making your Admin even more powerful. We'll cover how and when to use Flows in a Visualforce page, and how to manipulate events in both the Flow and Visualforce page/controller.
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.
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.
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.
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.