Businesses’ processes become more complex as they expand. Often, one flow alone can’t encapsulate an entire process. Herein comes the requirement for interconnecting and coordinating different flows. Just as in a relay race where batons are passed between runners, we pass variables between flows in Salesforce. This guarantees that procedures continue without interruption and that data integrity is upheld throughout.
In this blog, you will learn:
- how to pass variables between flows.
Why Pass Variables Between Flows?
Salesforce Flows has a tonne of power for streamlining and automating business operations. While each Flow can operate as a standalone entity, there are scenarios where data must be shared between them, necessitating the passing of variables from one Flow to another.
- Chaining Processes: Business operations often involve a series of interlinked tasks. Rather than creating a monolithic Flow, it’s often more efficient to break down these tasks into smaller flows and chain them together. By passing variables, each Flow can continue where the previous one left off.
- Reusability: Instead of repeatedly creating the same sequences in multiple Flows, you can design a common sub-flow that performs a standard operation and use it across different main Flows. This not only enhances efficiency but also ensures consistency in operations.
- Modular Architecture: Breaking processes into modular Flows makes maintenance easier. If a specific part of the process needs to be updated, only the relevant Flow needs to be modified without affecting others. This modularity is achieved seamlessly by passing variables between the Flows.
How to Pass Variables? Step-by-Step Guide:
1. Creating the main Flow (Parent Flow):
- Navigate to Salesforce Setup.
- Search for Flows and click on ‘New Flow’.
- Choose the type of Flow that suits your need (e.g., ScreenFlow, Auto-Launched Flow).
- Design the parent Flow per the business requirement, keeping in mind the points where data needs to be sent to or received from another Flow.
2. Defining Input and Output variables in the sub-flow (Child Flow):
- Create a new Flow or navigate to an existing one you wish to act as the Child Flow.
- Under the ‘Manager’ tab in Flow Builder, create ‘Input’ or ‘Output’ variables as per the data to be passed between the Flows. Ensure they are set to ‘Available for Input’ or ‘Available for Output’ respectively.
3. Adding the sub-flow to the main Flow:
- Drag and drop the ‘Subflow’ element onto the canvas in the Parent Flow’s builder.
- Select the desired Child Flow from the list. This will now act as a callable sub-flow within your main Flow.
4. Mapping variables from the main Flow to the sub-flow:
- After selecting the Child Flow in the Subflow element, you’ll see the list of available input and output variables that you previously defined in the Child Flow.
- Map each of these variables to the corresponding variables or values in your main Flow. This will ensure that data is passed between the Flows as intended when the main Flow reaches the Subflow element.
Conclusion
Salesforce Flows provides a robust platform to automate and integrate complex business processes, as demonstrated by the e-commerce example above. The ability to pass variables between flows enhances efficiency and ensures data consistency and integrity across processes.
Connect with our Slack group and immerse yourself in the Salesforce universe to uncover emerging patterns and the most recent developments. This community offers a platform for enlightening conversations, sharing insights, and connecting with industry specialists.
For those eager to further their skills, saasguru’s online Salesforce bootcamps offer hands-on training with real projects. Don’t miss out on this opportunity to elevate your Salesforce expertise.
Join us today!