Flow Actions
Visual Workflows Mastery
Master Flow automation for agents — when Standard Actions aren't enough. Loops, conditionals, sub-flows, multi-step orchestration. Real XYZ Company batch processing workflows, intelligent routing. Build complex logic visually. No code needed. Interview ready!
Part 1: Flow Fundamentals
What is a Flow? 4 types. When to use Flows. Why agents love them.
| Flow Type | Trigger | Best For | Real-World Example |
|---|---|---|---|
| Cloud Flow (Invocable) | Agent invokes + other sources | Agent logic, reusable workflows, entry points | Agent calls “Find Top Opportunities” Flow — Flow runs query + analysis + returns results |
| Record-Triggered | Record creates or updates | Auto-responses, enforcement, notifications | When Opportunity moves to “Closed Won”, Flow auto-creates celebration Task for team |
| Scheduled | Time-based (daily, hourly, weekly) | Batch jobs, nightly syncs, cleanup | Every night at 2 AM, Flow syncs customer data from SAP to Salesforce |
| Platform Event | Custom event fires | Real-time async messaging, integrations | When “Order Shipped” event fires from external system, Flow notifies customer via email |
| Scenario | Use Standard Action? | Use Flow? | Why? |
|---|---|---|---|
| Agent says “Get ABC Pharma Account” | ✅ YES (Get Record) | ❌ No | Single record = simple. No processing needed. Standard Action is faster & lighter. |
| Agent needs all open Opps > ₹50L, sorted by amount | ❌ No (can't sort) | ✅ YES (Query + sort element) | Query with sorting. Flow handles this cleanly with visual Sort element. |
| Agent needs to loop through 10 Opps & analyze each with AI | ❌ No (can't loop) | ✅ YES (Loop + Action Call) | Standard Actions don't loop. Flow's Loop element + Action Call to invoke Prompts = perfect! |
| Agent needs to check if Opp > ₹100L, then escalate OR follow-up | ❌ No (no routing) | ✅ YES (Decision) | Conditional routing. Flow's Decision element branches logic based on condition. |
| Create Case + Send Email + Create Task in sequence | ✅ YES (3 actions) | ✅ ALSO YES (Flow) | Either works! Standard Actions = simple & fast. Flow = if you need error handling between steps. |
Flow: Multi-step, loops, conditionals, batch processing, error handling. When in doubt about multi-step logic, Flow is your answer!
✅ Visual: See entire workflow at a glance. No code to decipher. Non-technical people can understand.
✅ Maintainable: Change logic without touching code. Move a decision box, add a loop, update a query — all visual.
✅ Debuggable: Flow Builder shows you exactly where execution stopped. Error message pinpoints the problem.
✅ Reusable: Build Flow once, invoke from multiple agents. Update Flow in one place — all invocations get new logic.
✅ Testable: Flow has built-in test runner. No unit test framework needed. Click “Test” — see results immediately.
Part 2: 5 Essential Flow Elements
Query, Loop, Decision, Create/Update, Action Calls. Building blocks of every Flow.
Object: Opportunity
Conditions:
— StageName NOT IN (’Closed Won’, ’Closed Lost’)
— Amount > 5000000 (₹50L)
Sort: Amount DESC (largest first)
Limit: 20 records
Output Variable: openOpps (collection of Opportunities)
Usage: Loop through openOpps, analyze each one
Loop Setup:
Collection: openOpps (from Query)
Loop Variable: currentOpp
Inside Loop (executed 10 times):
1. [Action Call] Invoke Prompt Template “Opportunity Summary”
Input: currentOpp.Id
Output: aiSummary (text)
2. [Add to Collection] Add {oppId, oppName, amount, aiSummary} to results
After Loop: results collection has 10 items (all analyzed)
Return to Agent: Agent displays all 10 summaries!
Condition:
Amount > 10000000 (₹100L)?
IF YES (High-value Opp):
✅ Create Task: “ESCALATE: Large Opportunity ₹[Amount] — Needs Manager Approval”
✅ Assign to: Sales Manager queue
✅ Priority: High
✅ Set flag: needs_escalation = true
IF NO (Standard Opp):
✅ Create Task: “Follow up on ₹[Amount] opportunity”
✅ Assign to: Rep's own queue
✅ Priority: Medium
✅ Set flag: needs_escalation = false
Flow Steps:
1. [Query] Get all Accounts
WHERE LastActivityDate < TODAY — 30
Result: inactiveAccounts (20 records)
2. [Loop] For each Account in inactiveAccounts
a. [Create] New Task
Subject: “Follow up with [Account Name] — No activity 30 days”
Priority: Medium
Assigned To: Account Owner
Due Date: Today + 3
Result: 20 tasks created & assigned to reps automatically!
1. [Query] Get top 5 open Opportunities by Amount
Output: topOpps (collection)
2. [Loop] For each Opp in topOpps
a. [Action Call] Invoke “Opportunity Summary” Prompt Template
Input: currentOpp.Id
Wait for: AI generates summary (2-3 seconds)
Output: summary (text)
b. [Decision] Is summary mention “risk” or “concern”?
YES: Mark as riskFlag = true
NO: Mark as riskFlag = false
c. [Add to Collection] Collect {oppId, summary, riskFlag}
3. [Return] Send collection back to Agent
Agent sees: 5 Opportunities with AI summaries + risk flags!
Part 3: Real Workflows (XYZ Company)
Production-ready Flows agents actually use. Complete examples.
Output: Analyzed Opportunities list (with AI summaries & escalation flags)
Time: ~15-20 seconds for 10 Opps (depends on prompt complexity)
Flow Actions — Interview Questions
Real patterns from Agentforce developer interviews
| Interview Question | Best Answer |
|---|---|
| When would you use a Flow instead of Standard Actions? | When you need loops (process multiple records), conditionals (routing logic), multi-step sequences with error handling, or batch operations. Standard Actions = single task. Flow = orchestration of complex logic! |
| Describe a Loop element in Flow. Real example? | Loop iterates through collection of records. For each record, perform action(s) inside loop. Real example: Query 10 open Opps → Loop through each → Invoke Prompt Template for AI summary → Collect results → Return 10 analyzed Opps to agent. Batch processing done! |
| Design a Decision element: if Opp amount > ₹100L, escalate. How? | Use Decision element. Condition: Amount > 10000000. IF YES path: Create escalation task, assign to manager, set priority High. IF NO path: Create standard follow-up task, assign to rep, priority Medium. Each path has different actions! |
| Design a Flow: Query all Cases for Account, send email for each. Steps? | 1. Get Account ID (input). 2. Query: Cases WHERE AccountId = this Account. 3. Loop through Cases collection. 4. Inside loop: Send Email action (personalized for each case). 5. After loop: Return success count. Result: Bulk emails sent to all cases! |
| Can Flows invoke Prompt Templates? Real scenario? | YES! Action Call element invokes Prompt Templates. Real scenario: Flow queries 5 top Opportunities → Loops through each → Inside loop: invokes "Opportunity Summary" Prompt for AI analysis → Collects results. Agent sees 5 AI-analyzed Opps instantly! |
| What are differences between Flow and Apex for Agents? | Flow = visual, no-code, great for orchestration & batch logic. Apex = code-based, performance-critical, complex algorithms. Use Flow for multi-step workflows ✓ Use Apex when Flow too slow or logic too complex ✓ |
Module 8 Summary — Flow Actions Mastered
What you know now
- ✅4 Flow Types: Cloud Flow (agents use this ✓), Record-Triggered, Scheduled, Platform Event. Know which triggers when!
- ✅When to Use Flow: Multi-step logic, loops, conditionals, batch operations. Standard Actions = single task. Flow = orchestration!
- ✅5 Key Elements: Query (fetch records), Loop (iterate collections), Decision (IF/THEN routing), Create/Update (CRUD ops), Action Call (invoke Prompts & other Flows).
- ✅Real XYZ Flow #1: Batch Opportunity Analysis — Query → Loop → Invoke Prompts → Conditional escalation → Return analyzed list!
- ✅Real XYZ Flow #2: Intelligent Case Routing — Get case → Evaluate priority & category → Route to right queue → Notify team!
- ✅Flows + Prompts = AI Power: Action Call element invokes Prompt Templates. Inside loops for batch AI analysis. Unlock intelligence!
- ✅Interview Ready: All 6 common Flow questions memorized. Can design complex Flows from scratch!
🚀 Ready for Module 9?
Next: Apex Actions — Custom Code Power You'll master Apex for agents: when to use, code patterns, error handling, performance. When Flows can't cut it — Apex is your tool!
Module 9: Apex Actions —
New interview questions every week
Follow for fresh Salesforce Q&A, free courses, and real interview experiences — straight from the trenches.
Follow Us ↗1,500+ free questions, kept free thanks to readers like you.
Help Us Keep This Free →Free Salesforce interview prep, structured courses and practice quizzes. Built by a working Salesforce developer — no paywalls, no signup.