Agentforce Flow Actions — Automate with Salesforce Flows 2026

📅  Agentforce
Agentforce Course — Module 8: Flow Actions | sfinterviewpro.com
🤖 Free Agentforce Course 2026 — sfinterviewpro.com
🔄 Module 8 of 15

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!

4
Flow Types
5
Key Elements
100%
Visual Build
Production
Ready
📍 Course Progress — Module 8 of 15
M1
M2
M3
M4
M5
M6
M7
M8Flow
M9Apex
M10API
M11Data
M12Deploy
M13Scale
M14Test
M15Done
🎯 What You'll Master in This Module
4 Flow types (Cloud Flow for agents). When to use Flows vs. Standard Actions. 5 essential elements (Query, Loop, Decision, Create/Update, Action Calls). Real XYZ workflow: batch opportunity analysis. Intelligent case routing with conditionals. Invoking Prompt Templates inside loops. Interview patterns. By end, you'll orchestrate complex workflows visually!
📚

Part 1: Flow Fundamentals

What is a Flow? 4 types. When to use Flows. Why agents love them.

Flow = visual workflow automation. No code. Drag-drop building blocks (queries, loops, conditionals, actions). Agents invoke Flows to execute multi-step logic. Perfect when Standard Actions can't handle loops, conditionals, or complex sequences. Think of Flow as the “conductor” orchestrating all your actions!
1
4 Flow Types — Know the Difference
Each type triggers differently
Flow TypeTriggerBest ForReal-World Example
Cloud Flow (Invocable)Agent invokes + other sourcesAgent logic, reusable workflows, entry pointsAgent calls “Find Top Opportunities” Flow — Flow runs query + analysis + returns results
Record-TriggeredRecord creates or updatesAuto-responses, enforcement, notificationsWhen Opportunity moves to “Closed Won”, Flow auto-creates celebration Task for team
ScheduledTime-based (daily, hourly, weekly)Batch jobs, nightly syncs, cleanupEvery night at 2 AM, Flow syncs customer data from SAP to Salesforce
Platform EventCustom event firesReal-time async messaging, integrationsWhen “Order Shipped” event fires from external system, Flow notifies customer via email
✅ For Agents: Cloud Flow (Invocable)
Agents invoke Flows = Cloud Flows (also called “Autolaunched Flows”). These accept inputs & return outputs. Agent passes data — Flow processes — Flow returns results — Agent displays. This is the flow type you'll use 99% of the time with agents!
2
Standard Actions vs. Flows — Decision Matrix
When to use what
ScenarioUse Standard Action?Use Flow?Why?
Agent says “Get ABC Pharma Account”✅ YES (Get Record)❌ NoSingle 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.
🎯 Rule of Thumb
Standard Action: Single, simple task (Get one record, Query once, Create, Update, Send Email, Create Task).
Flow: Multi-step, loops, conditionals, batch processing, error handling. When in doubt about multi-step logic, Flow is your answer!
3
Why Agents Love Flows
Benefits — visibility — maintainability

✅ 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.

💡 Flows = Better Agent Logic
Flows separate business logic from agent behavior. Agent focuses on conversation. Flow handles complex orchestration. Clean, maintainable, scalable!
🧩

Part 2: 5 Essential Flow Elements

Query, Loop, Decision, Create/Update, Action Calls. Building blocks of every Flow.

1
Element 1: Query — Fetch Records
SOQL inside visual Flow
Query Element = SOQL query executed inside Flow. Input: WHERE clause criteria. Output: Collection variable (list of records). Foundation for loops & batch analysis.
📋 XYZ Example: Query Open Opportunities
Element Name: GetOpenOpportunities
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
✅ Query Best Practices
Keep queries fast & targeted. Use indexed fields (Name, Amount, CreatedDate). Limit results (10-50, not 10K). Filter aggressively with WHERE conditions. Query = foundation for everything else!
2
Element 2: Loop — Process Collections
Iterate through list of records. Do something for each.
Loop Element = iterate through collection (list of records). For each record, perform action(s) inside loop. Current item accessible as loop variable. Perfect for batch processing!
📋 XYZ Example: Analyze Each Opportunity with AI
Previous Step: Query returned 10 open Opportunities in collection

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!
✅ Loop Power
Loops handle batch operations. Query 10 records — Loop processes all 10. Invoke AI for each — Collect results. Perfect for agents needing “analyze all” commands!
3
Element 3: Decision — Conditional Routing
IF/THEN/ELSE logic. Route to different paths based on conditions.
Decision Element = evaluates condition (IF Amount > 100L). Routes to different paths based on result. YES path — escalate. NO path — standard follow-up. Intelligent routing!
📋 XYZ Example: Escalate Large Opportunities
Decision Name: IsLargeOpportunity

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
✅ Decision Best Practices
One condition per Decision element. Multiple conditions = multiple Decision boxes. Keep logic simple & readable. Name decisions clearly (IsLargeOpp, HasReceivedComplaint, etc.).
4
Element 4: Create & Update Records
CRUD operations inside Flows. Often in loops for batch ops.
Create & Update Elements = exactly what they sound like. Create new records or update existing ones. Often used inside Loop for batch operations.
📋 XYZ Example: Batch Create Follow-Up Tasks
Scenario: Need to create follow-up tasks for all accounts with no activity in 30 days

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!
⚠️ Bulk Operations Caution
Don't Create/Update 10K records with one Flow — hits limits! Use loops with limits < 1000. For massive bulk ops, use Apex batch job instead!
5
Element 5: Action Calls — Invoke Prompts & Flows
Connect Flow to AI. Invoke Prompt Templates + other Flows.
Action Call Element = invokes Prompt Templates, Standard Actions, or other Flows from inside Flow. This is how Flow unlocks AI power! Inside Loop: invoke Prompt for each record.
📋 XYZ Example: Invoke AI Summary Inside Loop
Flow: BatchAnalyzeOpportunities

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!
✅ Action Calls = AI Power
This is where Flows become intelligent! Invoke Prompts inside loops = batch AI analysis. Invoke other Flows = sub-flows for modularity. Invoke Standard Actions = orchestrate all CRUD!
🏗️

Part 3: Real Workflows (XYZ Company)

Production-ready Flows agents actually use. Complete examples.

1
Flow #1: Batch Opportunity Analysis
Agent: “Analyze all open Opps over ₹50L” → Flow runs smart analysis
📋 Flow Name: AnalyzeTopOpportunities
Input: minAmount (e.g., 5000000 for ₹50L)
Output: Analyzed Opportunities list (with AI summaries & escalation flags)
Time: ~15-20 seconds for 10 Opps (depends on prompt complexity)
FLOW LOGIC (Visual breakdown): Step 1: [Query] GetOpenOpportunities WHERE Amount > minAmount ORDER BY Amount DESC LIMIT 20 → Output: openOpps (collection) Step 2: [Loop] For each Opp in openOpps Step 2.1: [Action Call] Invoke Prompt: "Opportunity Summary" Input: currentOpp.Id Output: aiSummary (text) Step 2.2: [Decision] IsLargeOpportunity Condition: currentOpp.Amount > 10000000? YES: priority = "ESCALATE" NO: priority = "FOLLOW_UP" Step 2.3: [Create] Add to resultsCollection {oppId, oppName, amount, stage, aiSummary, priority} Step 3: [Return] Send resultsCollection to Agent RESULT for Agent: ✅ 10-20 Opportunities analyzed ✅ Each has AI-generated summary ✅ Escalation flags set automatically ✅ Sorted by amount ✓ ready for action!
💡 Intelligent Routing Benefits
Instead of support agent manually assigning cases, Flow auto-routes based on rules. High priority quality issue? Auto-routes to Quality Team. Billing complaint? Billing Team. Ensures SLA compliance ✅ reduces manual work ✅!
🎤

Flow Actions — Interview Questions

Real patterns from Agentforce developer interviews

Interview QuestionBest 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!
🎉 You're a Flows Expert!
Flows are where agents get SMART. Loops + conditionals + AI = powerful, maintainable workflows. You can now design complex, production-ready agent logic without touching code!
🧠 Module 8 — Knowledge Check
Q1: When would you use Flow vs. Standard Action? — Standard Action = single task. Flow = multi-step, loops, conditionals, orchestration. Need loops? Flow is your answer!
Q2: Describe Loop element with real example. — Loop iterates collection. For each record, perform action. Real: Query 10 Opps → Loop → Invoke Prompt for each → Collect AI summaries → Return to agent!
Q3: Decision element: Amount > ₹100L? — Use Decision. Condition checks amount. YES path: escalate (create task, assign to manager). NO path: follow-up (standard task, assign to rep).
Q4: Flow to Query Cases & email each? — 1. Get Account. 2. Query Cases. 3. Loop through. 4. Inside loop: Send Email. 5. After loop: Return success count. Bulk emails sent!
Q5: Can Flows invoke Prompts? Real scenario? — YES! Action Call. Query 5 top Opps → Loop → Inside: invoke "Opp Summary" Prompt → Collect AI results → Return 5 analyzed Opps!

🚀 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 —
SF
By SF Interview Pro
Salesforce Interview Prep Team
Practical Q&A by working Salesforce professionals · LWC, Apex, Data Cloud & AI
About Us ↗
☕ Enjoyed this article?
SF Interview Pro is 100% free and maintained by a Salesforce professional. No ads, no paywalls, and no signup required. If this guide helped you prepare for an interview, earn a certification, or grow your Salesforce career, consider buying me a coffee! ☕💜
🇮🇳 UPI (India)
UPI QR Code to support sfinterviewpro
Pay by QR
GPay · PhonePe · Paytm · BHIM
🌎 International
PayPal QR Code to support sfinterviewpro Pay via PayPal ↗
Scan or tap to pay