Administration
Lightning Flow Builders Interview Questions and Answers Experienced
1. What is Salesforce Flow?
Salesforce Flow is a declarative automation tool that allows users to automate complex business processes without writing code. It provides a visual interface to design workflows that can handle a variety of tasks, such as updating records, sending emails, and integrating with external systems.
2. What are the different types of Flows in Salesforce?
The different types of Flows include:
- Screen Flows: Used for user-guided experiences, allowing users to input data through screens.
- Record-Triggered Flows: Triggered automatically when a record is created or updated.
- Scheduled Flows: Run at specified intervals to automate recurring tasks.
- Auto-launched Flows: Triggered programmatically or by other processes, without user interaction.
3. What are the main elements used in Flow Builder?
The main elements include:
- Assignment: Assigns values to variables.
- Decision: Branches the flow based on conditions.
- Loop: Iterates over a collection of items.
- Get Records: Retrieves records from the database.
- Create/Update/Delete Records: Performs DML operations.
- Screen: Displays screens to users for input or output.
- Subflow: Invokes another flow.
- Action: Calls Apex methods or external services.
4. How do you handle errors in Flows?
Errors can be handled using Fault Connectors, which direct the flow to error-handling paths when an element fails. Additionally, you can use the 'Send Email' action to notify users or admins about errors, and implement decision elements to manage exceptions gracefully.
5. What is an Invocable Method in Apex, and how is it used in Flows?
An Invocable Method is an Apex method annotated with @InvocableMethod
, making it accessible from Flow and Process Builder. It must be static and public, and it allows Flows to execute complex logic written in Apex.
6. How do you pass data between Flows and Invocable Methods?
Data is passed using input and output parameters defined in the Apex class. The method accepts a list of input parameters and can return a list of output parameters, which the Flow can then use.
7. What are Subflows, and when should they be used?
Subflows are Flows that are called from another Flow. They promote reusability and modularity by encapsulating logic that can be used in multiple Flows, reducing redundancy and simplifying maintenance.
8. How do you optimize Flows for performance?
To optimize performance:
- Minimize the number of elements and avoid unnecessary loops.
- Use efficient queries and limit the number of records processed.
- Handle errors gracefully to prevent flow failures.
- Test Flows thoroughly to identify and address performance bottlenecks.
9. What is the difference between Before-Save and After-Save Record-Triggered Flows?
Before-Save Flows execute before the record is saved to the database and are used for validations and setting field values. After-Save Flows execute after the record is saved and are used for actions like sending emails or updating related records.
10. How do you debug a Flow?
Use the Debug tool in Flow Builder to simulate the Flow run and inspect variable values and path decisions. Additionally, review debug logs in Salesforce to analyze the Flow's behavior during execution.
21. What is a Collection Variable in Flow?
A Collection Variable is used to store multiple records or values of the same data type. It's helpful in loops and bulk operations like bulk updates or deletes.
22. How can you update multiple records in a Flow?
Use a Loop element to iterate over a collection, update fields in each record using Assignment, and then use the Update Records element outside the loop with the final collection.
23. What are the limitations of Flows?
Limitations include:
- Governor limits like SOQL rows and CPU time.
- Debugging can be more complex than Apex.
- Bulkification challenges in Record-Triggered Flows.
24. How do you use Platform Events in Flows?
Flows can publish Platform Events using the "Create Records" element. Subscribing to Platform Events requires Apex Triggers; Flows can't directly subscribe.
25. What is a Screen Component in Flow?
A Screen Component allows user input or output in Screen Flows. Examples include text fields, picklists, radio buttons, and custom LWC components.
26. Can you call a Flow from Apex?
Yes, use the `Flow.Interview` class in Apex to invoke Auto-launched Flows.
27. How do you use a Choice Set?
Choice Sets provide dynamic options in screen components like picklists or radio buttons. You can use Record Choice Sets (from queries) or manually defined choices.
28. What is the use of Pause Element?
The Pause Element temporarily halts flow execution until a specified time or platform event resumes it. It's used in long-running business processes.
29. What is the Governor Limit for SOQL rows in Flows?
The limit is 50,000 records for synchronous flows and 1,000,000 for asynchronous. However, each SOQL query can't return more than 50,000 rows.
30. Can you use Apex-defined data types in Flows?
Yes, using Invocable Variables with Apex classes annotated with `@InvocableVariable`. This allows complex data to be passed into/out of Flows.
31. What is Flow Orchestration?
Flow Orchestration allows multiple Flows to be chained or run in a coordinated sequence with defined steps, assignments, and wait conditions. It helps model multi-step approvals or complex business processes.
32. How do you secure Flows in Salesforce?
Security is ensured using:
- Field-level security and object-level permissions.
- Running Flows in user or system context as needed.
- Permission Sets to control Flow access.
33. What is System Context in Flows?
Flows run in system context by default, meaning they ignore object- and field-level security unless explicitly configured to respect it. Screen Flows run in user context.
34. How do you ensure Flows are bulk-safe?
Avoid using "Get Records" inside loops, limit DML operations inside loops, and use collection variables to perform bulk operations outside loops.
35. How is Flow different from Workflow Rules or Process Builder?
Flow is more powerful and flexible, supporting complex logic, loops, screens, and subflows. Process Builder and Workflow Rules are now deprecated in favor of Flow.
36. What happens if a flow fails?
Flow failures trigger error emails (if configured) and appear in the Failed Flow Interviews section. Proper error handling and Fault connectors help mitigate issues.
37. What are Flow Interviews?
A Flow Interview is an instance of a flow execution. Each user interaction or system trigger starts a separate interview which can be paused, resumed, or errored.
38. Can you track Flow Usage?
Yes, through Setup > Paused and Failed Flow Interviews, Debug Logs, and Flow Usage Reports via Reports and Dashboards.
39. How do you test Flows effectively?
Use Debug mode, create test records, test each branch in isolation, and involve real user scenarios. Use Flow Test Automation (GA in Winter ‘25) for validation.
40. What are the best practices in Flow Development?
- Use naming conventions for variables and elements.
- Modularize with Subflows.
- Use error handling paths.
- Document Flow logic inside descriptions.
- Avoid DML or SOQL inside loops.