๐Ÿ  Home ๐Ÿ”’ Record Sharing ⚙ Apex Triggers ๐Ÿ” SOQL ๐Ÿ’ป LWC ๐Ÿ”— Integration ๐Ÿค– Flows & Automation ๐Ÿค– Agentforce & AI ๐ŸŽˆ Agentforce Course — Free ☁ Data Cloud ๐ŸŽ“ DC Course — Free ๐Ÿ’ต CPQ ๐ŸŽฏ 100 Scenario Questions ๐Ÿ† 150 Advanced Questions ๐Ÿ“ง Marketing Cloud ๐Ÿ—️ Company Wise ๐Ÿ‘ฅ About Us Start Learning Free →

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 —
Agent Starts Writing Salesforce Data!

Build Autolaunched Flows and connect them as agent actions. Your XYZ Sales Assistant will create Tasks, update Opportunities, and run multi-step business processes — all triggered by natural language.

2
Flows Built
DML
Agent Writes Data
Zero
Apex Code
100%
Practical
๐Ÿ“ Course Progress — Module 8 of 15
Agentforce
Trust Layer
Dev Org
Agent Builder
TIA
Prompt Builder
Std Actions
M8Flow Actions
M9Apex Actions
M10API Actions
M11Data Cloud
M12Deploy
M13Escalation
M14Testing
M15Full Project
๐ŸŽฏ What Changes in This Module
Until now your agent only READ Salesforce data. After this module, it WRITES data too — creating Tasks, updating Opportunities, triggering business processes. A sales rep can say "Create a follow-up task for ABC Pharma for next Monday" and the agent actually does it in Salesforce. That's the power of Flow Actions!
๐ŸŒŠ

1. What Are Flow Actions?

Autolaunched Flows that your agent triggers from conversation

Flow Actions are Salesforce Autolaunched Flows (screen-free Flows) that the agent can trigger from a conversation. The agent collects inputs from the user, calls the Flow with those inputs, the Flow runs its logic (DML operations, email sends, multi-step processes), and returns output back to the agent — which then reports results to the user.
AspectStandard ActionsFlow ActionsApex Actions (M9)
Who builds itSalesforce (pre-built)Admin / DeveloperDeveloper only
Code requiredNoneNone (visual Flow)Yes (Apex)
Can write data (DML)Limited✅ Yes — full DML✅ Yes — full DML
Best forCommon CRUD, emailMulti-step processes, DML with logicComplex SOQL, callouts
ExamplesQuery, Get Record, SummarizeCreate Task, Update Stage, Send notificationSOQL with aggregates, external API
๐ŸŒŠ How Flow Actions Work in Agent Conversation
๐Ÿ‘ค User: "Create follow-up task for ABC Pharma next Monday"
๐Ÿค– Agent collects inputs: AccountName="ABC Pharma", DueDate="Monday"
๐ŸŒŠ Calls Flow: "Create Follow-up Task" with collected inputs
๐Ÿ“Š Flow runs: Query Account → Create Task DML → Return Task ID
✅ Agent: "Done! I've created a follow-up task for ABC Pharma due Monday."
⚡ Key Rule — Flow Must Be Autolaunched
For a Flow to work as an agent action, it MUST be Autolaunched Flow type (not Screen Flow, not Record-Triggered Flow). Autolaunched = runs in background, no UI screens, receives inputs programmatically. This is the only Flow type agents can call.
๐Ÿ“‹

2. Flow Variables — How Agent Passes Data to Flows

The critical concept — inputs and outputs between agent and Flow

For an agent to call a Flow, the Flow must have Input Variables (data the agent passes IN) and optionally Output Variables (results the Flow passes back OUT). These variables must be marked correctly — otherwise the agent can't communicate with the Flow.
Variable SettingWhat It MeansRequired For
Available for Input ✅Agent can pass a value INTO the Flow for this variableAll input parameters (Account name, due date, stage value, etc.)
Available for Output ✅Flow can pass a value BACK to the agent after runningResults (Task ID, success message, error message)
Data TypeText, Date, Boolean, Record ID — must match what agent collectsAll variables
Variable NameThis becomes the parameter name the agent sees in Agent BuilderKeep it descriptive: accountName, dueDate, outputMessage
๐Ÿ“‹ Flow Variable Configuration Example — Create Task Flow
Variable Name
Data Type
Direction
Purpose
accountName
Text
Input ↓
Account name from user conversation
taskSubject
Text
Input ↓
What the task is about (e.g., "Follow-up call")
dueDate
Date
Input ↓
When the task is due
priority
Text
Input ↓
High / Normal / Low
outputMessage
Text
Output ↑
Result message agent shows user: "Task created for..."
taskId
Text
Output ↑
Salesforce ID of the created Task record
๐Ÿ’ก How Agent Collects Input Variables
When you add a Flow Action to the agent, Agent Builder shows you all Input Variables from the Flow. You can either:

1. Mark as Required — agent asks user to provide the value if not mentioned
2. Mark as Optional — agent uses default value if user doesn't provide it
3. Auto-populate — agent extracts from conversation context automatically

Example: User says "Create task for ABC Pharma next Monday" — agent extracts accountName="ABC Pharma" and dueDate="next Monday" from the message automatically.

3. Build Flow 1 — Create Follow-up Task

Agent creates a Salesforce Task linked to an Account from conversation

This Flow creates a Task in Salesforce linked to an Account. When the sales rep says "Create a follow-up call task for ABC Pharma next Monday" — the agent calls this Flow with Account name, subject, and due date — Flow creates the Task — agent confirms it's done.
๐ŸŒŠ Flow 1 Structure — Create Follow-up Task
▶️
Start
Autolaunched Flow — receives input variables from agent
Start
๐Ÿ“
Variables: accountName, taskSubject, dueDate, priority, outputMessage, taskId
Input vars: accountName (Text), taskSubject (Text), dueDate (Date), priority (Text, default "Normal"). Output vars: outputMessage (Text), taskId (Text)
Variables
๐Ÿ”
Get Records — Find Account by Name
Object: Account. Filter: Name = {!accountName}. Store in: varAccount. Get first record only.
Get Records
๐Ÿ”€
Decision — Account Found?
If varAccount is null → go to "Account Not Found" path. Else → go to "Create Task" path.
Decision
Create Records — Create Task
Object: Task. Set fields: Subject={!taskSubject}, ActivityDate={!dueDate}, Priority={!priority}, WhatId={!varAccount.Id}, Status="Not Started", Description="Created by XYZ Sales Assistant"
Create Records
๐Ÿ“‹
Assignment — Set Output Variables
outputMessage = "✅ Follow-up task created for " + {!accountName} + " — due " + {!dueDate}. taskId = {!varTask} (ID of created task)
Assignment
⚠️
Assignment — Account Not Found Path
outputMessage = "❌ I couldn't find an account named " + {!accountName} + " in Salesforce. Please check the account name and try again."
Assignment
๐Ÿ
End
Flow ends — outputMessage and taskId returned to agent
End
1
Create Flow 1 in Flow Builder
Setup → Flows → New Flow → Autolaunched Flow
a
Go to Setup → Quick Find: "Flows" → Click FlowsNew Flow
b
Select "Autolaunched Flow" → Click Create
Setup → Flows → New Flow → Autolaunched Flow → Create
c
You're now in Flow Builder. First, create all Input Variables. Click the Manager tab (left sidebar) → New ResourceVariable
d
Create these 4 Input Variables one by one:
Variable 1: API Name: accountName Data Type: Text ✅ Available for Input (check this!) ✅ Available for Output: No Default Value: (leave blank) Variable 2: API Name: taskSubject Data Type: Text ✅ Available for Input Default Value: "Follow-up Call" Variable 3: API Name: dueDate Data Type: Date ✅ Available for Input Default Value: (leave blank - agent provides this) Variable 4: API Name: priority Data Type: Text ✅ Available for Input Default Value: "Normal"
e
Create 2 Output Variables:
Variable 5: API Name: outputMessage Data Type: Text ✅ Available for Output (check this!) ✅ Available for Input: No Variable 6: API Name: taskId Data Type: Text ✅ Available for Output ✅ Available for Input: No
⚠️ Critical — Check the "Available for Input/Output" Checkbox!
This is the most common Flow Action mistake. If you DON'T check "Available for Input" on a variable, the agent cannot pass values to it. If you DON'T check "Available for Output," the agent cannot receive the result. Double-check all 6 variables before proceeding.
f
Now build the Flow elements on the canvas. Click "+" to add elements:
g
Add Get Records element:
• Label: Find Account
• Object: Account
• Filter: Name Equals {!accountName}
• How many records: First record only
• Store in: New variable "varAccount" (Record type: Account)
h
Add Decision element after Get Records:
• Label: Account Found?
• Outcome 1: "Yes" — condition: varAccount Is Null → equals → False
• Default Outcome: "No" (account not found)
i
On the "Yes" path, add Create Records element:
• Label: Create Task
• Object: Task
• Set field values:
Task Field Mappings: Subject = {!taskSubject} ActivityDate = {!dueDate} Priority = {!priority} WhatId = {!varAccount.Id} Status = "Not Started" Description = "Created by XYZ Sales Assistant" OwnerId = {!$User.Id} ← assigns to current user
j
After Create Records, add Assignment element:
• outputMessage = "✅ Follow-up task created for " + {!accountName} + " — due " + TEXT({!dueDate})
• taskId = {!varCreateTask} (the ID returned by Create Records)
k
On the "No" path (account not found), add another Assignment:
• outputMessage = "❌ I couldn't find an account named " + {!accountName} + ". Please check and try again."
l
Both paths lead to End. Save the Flow:
m
Click Save → Flow Label: "Create Follow-up Task" → API Name: Create_Followup_Task → Save
n
Click Activate — Flow must be Active to be used by agent!
Save → Label: "Create Follow-up Task" → Activate → Status: Active ✅
๐Ÿ“ธ Flow Builder — Final Flow Looks Like This
Canvas shows: Start → Get Records (Find Account) → Decision (Account Found?) → [Yes path] Create Records (Create Task) → Assignment (Set outputMessage) → End | [No path] Assignment (Set error outputMessage) → End

All variables visible in Manager panel on left. Flow status shows "Active" after Activate. ✅
✅ Flow 1 Built and Active!
"Create Follow-up Task" Autolaunched Flow is ready. Now we'll connect it to the XYZ Sales Assistant agent as a Flow Action. After connection, the agent can create real Salesforce Tasks from conversation!
2
Connect Flow 1 to XYZ Sales Assistant Agent
Add Create Follow-up Task as a Flow Action in Agent Builder
a
Setup → Agents → XYZ Sales Assistant → Agent Builder
b
Click Sales Assistant Topic → Actions → Add Action
c
In the Action picker — select "Flow" tab (not Standard)
d
Search for "Create Follow-up Task" → Select it → Click Next
e
Configure the Flow Action:
⚙️ Flow Action Configuration — Create Follow-up Task
Action Label
Create Follow-up Task
Description
Create a follow-up task in Salesforce linked to an Account. Use when user asks to create a reminder, task, follow-up call, or to-do item for a customer or account.
Input: accountName
Required ✅ — agent must collect Account name from user
Input: taskSubject
Optional — agent extracts from conversation (default: "Follow-up")
Input: dueDate
Optional — agent extracts date mentioned by user
Input: priority
Optional — default "Normal"
Require Confirmation
Yes — show user what will be created before executing
f
Click Save
✅ Flow Action Connected!
Sales Assistant Topic now has 5 Actions: 4 Standard + 1 Flow. The agent can now create real Salesforce Tasks from a simple conversation!
3
Build Flow 2 — Update Opportunity Stage
Agent updates deal stage with a simple voice command
This Flow updates an Opportunity's Stage. When the sales rep says "Move the MedTech deal to Closed Won" — agent calls this Flow — Flow updates the Opportunity record — agent confirms the update. Powerful DML from natural language!
a
Setup → Flows → New FlowAutolaunched Flow
b
Create these Variables:
Input Variables: opportunityName | Text | Available for Input ✅ newStage | Text | Available for Input ✅ closeDate | Date | Available for Input ✅ (optional) notes | Text | Available for Input ✅ (optional) Output Variables: outputMessage | Text | Available for Output ✅ opportunityId | Text | Available for Output ✅
c
Build the Flow on canvas:
๐ŸŒŠ Flow 2 Structure — Update Opportunity Stage
๐Ÿ”
Get Records — Find Opportunity
Object: Opportunity. Filter: Name CONTAINS {!opportunityName} AND IsClosed = False. Get first record only.
Get Records
๐Ÿ”€
Decision — Opportunity Found?
If varOpportunity Is Null → error path. Else → update path.
Decision
✏️
Update Records — Update Opportunity
Record: {!varOpportunity.Id}. Set: StageName = {!newStage}. If closeDate is not null: CloseDate = {!closeDate}. If notes not null: Description = {!notes}
Update Records
๐Ÿ“‹
Assignment — Set Success Output
outputMessage = "✅ " + {!opportunityName} + " stage updated to " + {!newStage}. opportunityId = {!varOpportunity.Id}
Assignment
d
Also add error path Assignment: outputMessage = "❌ Couldn't find open opportunity: " + {!opportunityName}
e
Save → Label: "Update Opportunity Stage" → API Name: Update_Opportunity_Stage
f
Click Activate
4
Connect Flow 2 to Agent + Update Instructions
Add Update Opportunity Stage as Flow Action
a
Agent Builder → Sales Assistant Topic → Actions → Add ActionFlow tab
b
Search "Update Opportunity Stage" → Select → Configure:
⚙️ Flow Action — Update Opportunity Stage
Action Label
Update Opportunity Stage
Description
Update the stage of a Salesforce Opportunity. Use when user asks to move a deal to a new stage, mark as Closed Won/Lost, or advance an opportunity in the pipeline.
opportunityName
Required — which deal to update
newStage
Required — valid stages: Qualification, Proposal/Price Quote, Negotiation/Review, Closed Won, Closed Lost
Require Confirmation
Yes — always confirm before updating records
c
Save → Then update Topic Instructions to include Flow Action rules:
// Add to Sales Assistant Topic Instructions: FLOW ACTION RULES: - When user asks to "create task", "add reminder", "schedule follow-up" → use "Create Follow-up Task" Flow - When user asks to "move deal to", "update stage", "mark as Closed Won/Lost", "advance opportunity" → use "Update Opportunity Stage" Flow - ALWAYS confirm with user before executing any DML action: "I'll create a task for [Account] due [Date] — shall I proceed?" - After successful Flow execution, confirm: "Done! [outputMessage]" - If Flow returns error message → share it clearly and offer to try again with corrected info - Valid Opportunity stages: Qualification, Proposal/Price Quote, Negotiation/Review, Closed Won, Closed Lost
d
Click Save
5
Test Flow Actions — Agent Writes Real Data!
The moment your agent starts creating and updating Salesforce records
a
Open Test PanelNew Session
๐Ÿงช Test 1 — Create Task from Conversation
๐Ÿ‘ค Sales Rep
Create a follow-up call task for ABC Pharma for next Monday
๐Ÿค– XYZ Sales Assistant
I'll create a follow-up task for ABC Pharma:

๐Ÿ“‹ Task Details:
• Subject: Follow-up Call
• Account: ABC Pharma Pvt Ltd
• Due Date: Monday, May 25, 2026
• Priority: Normal

Shall I create this task?
๐Ÿ‘ค Sales Rep
Yes, go ahead
⚙️ Flow Executing
→ Flow: Create_Followup_Task called → Input: accountName="ABC Pharma", taskSubject="Follow-up Call", dueDate=2026-05-25 → Get Records: Found ABC Pharma Pvt Ltd (Id: 001xx...) → Create Records: Task created (Id: 00Txx...) → Output: "✅ Follow-up task created for ABC Pharma — due 2026-05-25"
๐Ÿค– XYZ Sales Assistant
✅ Done! Follow-up call task created for ABC Pharma — due Monday, May 25, 2026.

You can view it in your Salesforce Activity list. Is there anything else you need?
๐Ÿงช Test 2 — Update Opportunity Stage
๐Ÿ‘ค Sales Rep
Move the MedTech Device Seals deal to Closed Won!
๐Ÿค– XYZ Sales Assistant
I'll update the MedTech - Device Seals Annual Contract opportunity:

๐Ÿ”„ Stage Update:
• Deal: MedTech - Device Seals Annual Contract
• New Stage: Closed Won ๐ŸŽ‰
• Amount: ₹18,00,000

Shall I update this opportunity to Closed Won?
๐Ÿ‘ค Sales Rep
Yes!
⚙️ Flow Executing
→ Flow: Update_Opportunity_Stage called → Input: opportunityName="MedTech Device Seals", newStage="Closed Won" → Get Records: Found Opportunity (Id: 006xx...) → Update Records: StageName updated to "Closed Won" → Output: "✅ MedTech - Device Seals Annual Contract stage updated to Closed Won"
๐Ÿค– XYZ Sales Assistant
๐ŸŽ‰ Congratulations! MedTech - Device Seals Annual Contract is now marked as Closed Won!

₹18,00,000 deal closed — great work! Would you like me to create a handover task or draft a thank-you email to Priya Sharma?
๐ŸŽ‰ Your Agent Writes Real Salesforce Data!
Check your Salesforce Tasks list — the follow-up task for ABC Pharma is there! Check MedTech Opportunity — it's now Closed Won! Your agent doesn't just talk — it takes real action in Salesforce. This is the power of Flow Actions!
๐Ÿ’ก

4. Advanced Flow Action Tips

Production-quality patterns for Flow Actions

TipWhyHow
Always return an outputMessageAgent needs to tell user what happened. Without outputMessage, agent says nothing after Flow runs.Create outputMessage Text variable (Available for Output). Set it in every Flow path — success AND error.
Handle "not found" casesUsers misspell names. Flow must handle missing records gracefully.Decision element after Get Records → check if result is null → set friendly error in outputMessage
Use CONTAINS not EQUALS for name searchUsers rarely type exact Salesforce record names. "ABC Pharma" vs "ABC Pharma Pvt Ltd"In Get Records filter: Name CONTAINS {!accountName} — more flexible than exact match
Always require user confirmationAgents can misinterpret requests — DML is irreversible in most casesSet "Require Confirmation" = Yes in Action configuration. Agent shows what it will do → user confirms → Flow runs
Run Flow in User modeSecurity — Flow should respect the current user's sharing rulesIn Flow properties → select "Run as" → "User" (not System). This enforces Salesforce sharing model.
Keep Flows focusedOne Flow = one action. Don't build a "do everything" Flow.Create Task Flow, Update Stage Flow, Send Email Flow — separate Flows, each connected as separate Action
๐Ÿ”ง

5. Troubleshooting Flow Actions

Most common issues — solved

ProblemRoot CauseFix
Flow Action not appearing in Agent Builder pickerFlow is not Activated, OR Flow is not Autolaunched typeSetup → Flows → Find your Flow → Activate it. Verify Flow Type = "Autolaunched Flow" (not Screen Flow)
Agent calls Flow but inputs are blank/nullVariables not marked "Available for Input"Flow → Manager → Variable → Edit → Check "Available for Input" → Save → Re-activate
Agent runs Flow but doesn't show result to useroutputMessage variable not marked "Available for Output"Mark outputMessage as "Available for Output" in Flow variables. Agent reads this variable for the response.
Flow fails with "insufficient privileges"Flow running in System context but underlying record not accessibleIn Flow Properties → Run As → select "User" to run with current user's permissions
Get Records returns null even though record existsFilter using EQUALS but user typed partial nameChange filter from "Name Equals" to "Name Contains" {!accountName}
Agent asks user for inputs already mentionedAgent not extracting values from conversation contextIn Action configuration, map inputs to "Collect from conversation" — agent extracts from what user said
๐ŸŽฏ

6. Flow Actions — Interview Questions

Common Agentforce Flow Action questions

Interview QuestionBest Answer
What type of Flow can be used as an Agentforce action?Only Autolaunched Flows (screen-free). Screen Flows and Record-Triggered Flows cannot be used. Autolaunched = runs in background, receives inputs programmatically, returns outputs to caller.
How does an agent pass data to a Flow?Via Flow Input Variables marked "Available for Input." Agent Builder shows all input variables — you configure each as Required or Optional. Agent extracts values from conversation and passes them to the Flow when calling it.
How does a Flow return results to the agent?Via Flow Output Variables marked "Available for Output." Typically an outputMessage (Text) variable containing a human-readable result. Agent reads this variable and includes it in the response to the user.
Why should you always include an outputMessage variable?Without it, the agent runs the Flow silently — user sees no confirmation. outputMessage provides the success/failure result that the agent communicates back to the user after Flow execution.
When would you use Flow Actions vs Apex Actions?Flow Actions: DML operations, multi-step processes, email sends — no code required, admin-maintainable. Apex Actions: complex SOQL (joins, aggregates), external callouts, complex business logic that can't be expressed in Flow. Try Flow first — use Apex when Flow can't handle it.

Module 8 Summary

Agent now reads AND writes Salesforce data!

  • Flow Actions — Autolaunched Flows called by agent. Agent reads Actions (M7) + writes data (M8). Full CRUD capability!
  • Input Variables — "Available for Input" lets agent pass values to Flow. Extract from conversation automatically.
  • Output Variables — "Available for Output" lets Flow return results to agent. Always include outputMessage!
  • Flow 1 Built — "Create Follow-up Task": finds Account → creates Task → returns confirmation
  • Flow 2 Built — "Update Opportunity Stage": finds Opportunity → updates Stage → returns confirmation
  • Both Flows Connected — added to Sales Assistant Topic as Flow Actions
  • Tested Live — agent created real Task + updated real Opportunity from natural language conversation
  • Always use CONTAINS, outputMessage, confirmation, User mode — production Flow Action patterns
๐ŸŽฏ What Your Agent Can Do Now
✅ Retrieve Account information | ✅ Show Opportunity pipeline | ✅ Get Contact details
✅ Generate AI follow-up emails | ✅ Summarize records | ✅ Create follow-up Tasks
✅ Update Opportunity stages

Module 9 adds Apex Actions — complex SOQL queries with multiple objects, aggregates, and custom business logic. Your agent gets even smarter!
๐Ÿง  Module 8 — Knowledge Check
Q1: What type of Flow can be used as an Agentforce action? → Autolaunched Flow only — screen-free, runs in background, receives inputs programmatically. Screen Flows and Record-Triggered Flows cannot be used.
Q2: A Flow Action runs but the agent shows nothing to the user. Why? → outputMessage variable not marked "Available for Output." Add outputMessage Text variable → check Available for Output → re-activate Flow → agent will show it.
Q3: User says "Create task for ABC Pharma" but Flow returns null for accountName. Why? → accountName variable not marked "Available for Input" in Flow. Edit variable → check Available for Input → Save → Activate.
Q4: Flow's Get Records finds nothing even though the Account exists. Most likely cause? → Filter using EQUALS instead of CONTAINS. User typed "ABC Pharma" but record is "ABC Pharma Pvt Ltd." Change filter to Name CONTAINS {!accountName}.
Q5: When should you use Flow Actions vs Apex Actions? → Flow: DML, multi-step, email, admin-maintainable. Apex: complex SOQL (aggregates/joins), external callouts, complex logic Flow can't handle. Try Flow first — Apex for what Flow can't do.

๐Ÿš€ Ready for Module 9?

Next: Apex Actions — Write @InvocableMethod Apex classes your agent calls directly. Complex SOQL with multiple objects, aggregate queries, external callouts, and business logic that Flow can't handle. Your agent becomes a true developer-grade AI assistant!

Module 9: Apex Actions →