Sub topic 3
Why a Data-Changing Action Should Ask First
This chapter assumes you know basic Salesforce objects and records. It also assumes you know what an Agentforce agent is, and that you can read a simple Flow or Apex invocable method. It explains the reasoning behind a confirmation step. Later chapters show how to switch it on, word it, and test it.
The core problem: the agent acts on its own reading of the conversation
An Agentforce agent does not run a fixed script. A large language model (LLM) reads the conversation, picks a topic, chooses an action, and fills in the action's inputs. That is useful, because users can speak naturally. It also means every action call is based on the agent's interpretation of what the user wants.
For an action that only reads data, a wrong interpretation costs little. The user sees the wrong answer and rephrases. For an action that creates, updates, or deletes records, a wrong interpretation changes the org's data. The user may not notice until later, and other people or automations may already have acted on the changed record.
A confirmation step puts a human decision between the agent's interpretation and the change. The agent states what it is about to do. The user approves or declines. Only then does the action run.
Where misinterpretation comes from
Misreadings usually fall into a few groups. Knowing them helps you decide which actions need a confirmation step.
Ambiguous references
A user says "close the case" while the conversation has mentioned two cases. The agent picks one. If it picks the wrong one, the wrong record is closed. The agent may seem confident because the model does not signal doubt the way a person would.
Wrong or guessed input values
The agent must supply every required input. If the user's message does not contain a value, the model may infer one from context. For the UpdateCaseStatusAction method in the topic spine, the user might say "wrap up case 5001R00000AbCdE". The agent has to decide whether the new status is Closed, Resolved, or another picklist value. A guess that happens to be a valid value passes validation and saves without error.
Misread intent
The user may be thinking aloud, asking a hypothetical ("what would happen if I closed this?"), or asking about a process. The agent can still treat the message as a command.
Instruction drift in long conversations
Topic instructions and earlier turns compete for the model's attention. In a long conversation, the agent may skip a step it would normally take. This is one reason to enforce confirmation in more than one place, which a later chapter covers.
Untrusted text inside data
Agents read record fields, emails, and chat messages. That text can contain wording that looks like an instruction. A confirmation step gives the user a chance to see an unexpected change before it happens. It is not a complete defense against this kind of attack, but it is a useful check.
Why reversibility matters
Not every change is equally hard to undo. When you decide how much friction to add, ask how easily the change can be reversed.
| Change | Typical reversibility | Risk if the agent is wrong |
|---|---|---|
| Reading a record | Nothing changes | Low. The user sees a wrong answer. |
| Updating a text field with field history tracking | Old value can be restored from history | Medium. Someone must notice and fix it. |
| Updating a field with no history | Old value is lost unless the user remembers it | Medium to high |
| Closing a case | Usually reopenable, but may trigger automation | Medium. Emails, assignments, or SLA changes may already have fired. |
| Deleting a record | Recoverable from the Recycle Bin for a limited time, with exceptions | High |
| Sending an email or creating a payment | Cannot be recalled | High |
Two points apply here. First, the data change is often not the whole effect. Flows, triggers, and approval processes that run on the change may send notifications or update related records. Undoing the field value does not undo those effects. Second, reversibility depends on what you configured. Field history, for example, only exists for fields where you enabled tracking.
Reads versus writes: classify before you decide
The previous chapter in this tutorial covers spotting data-changing actions in detail. In short, look at what the action does inside, not what its name suggests. A Flow named "Case Helper" may only read, or it may update and send email. Check for these elements:
- Apex DML statements (
insert,update,delete,upsert,undelete,merge) - Flow elements such as Create Records, Update Records, and Delete Records
- Callouts or subflows that change data in another system
- Actions that send messages to customers
An action can also be a read in one path and a write in another. If any path changes data, treat the whole action as data-changing.
What a good confirmation does
A confirmation step is only useful if the user can make an informed choice. A bare "Are you sure?" gives them nothing to check. A useful confirmation has these parts:
- It names the record. A case number or subject is better than "the case".
- It states the change in concrete terms, including the new value.
- It asks a question the user can answer with yes or no.
- It waits. The action does not run until the user clearly agrees.
Compare these two agent messages for the case update in the topic spine.
Weak: Are you sure you want to continue?
Better: I will set the status of case 5001R00000AbCdE to Closed. Do you want me to go ahead?The better message exposes any wrong guess. If the agent picked the wrong case or the wrong status, the user can see it and say so. The confirmation is only as good as the information the agent has about the action. That is why the labels and descriptions on the action's inputs matter, which a later chapter covers.
The flow of a confirmed action
The sequence below shows where the confirmation sits between the user's request and the data change.
Notice that the agent chooses the action and its inputs before it asks. The confirmation reviews a complete plan, not a half-formed idea.
What confirmation does not do
Confirmation is one control among several, and it has limits. Knowing them avoids a false sense of safety.
- It does not check permissions. If the running user lacks access, the action should fail on its own. A user who approves a change they are not allowed to make should still be blocked. Build that check into the action and the permission model, not into the conversation.
- It does not validate values. A user can approve a wrong value as easily as a right one, especially when approvals become routine.
- It does not replace good action design. An action that can delete any record from a free-text Id is risky even if it asks first.
- It adds friction. Each confirmation costs a turn. If every action asks, including harmless reads, users learn to say "yes" without reading. This is often called confirmation fatigue, and it makes the real protection weaker.
Choosing which actions need to ask
You do not need a formal scoring system. A few questions are enough to decide.
- Does the action create, update, or delete data, or trigger effects outside Salesforce?
- Could the agent get a record or value wrong from natural language?
- Is the change hard to undo, or does it trigger automation that is hard to undo?
- Would the user be surprised to see the change?
A "yes" to the first question and to any of the others means the action should ask first. Low-stakes writes may reasonably skip it. An example is an action that logs a note to the user's own activity list. Even then, a team may choose to confirm everything that writes, for consistency and to simplify the rules for builders. A later chapter in this tutorial covers that decision.
Two layers you will use
Agentforce gives you two ways to add the pause, and they work together.
- The action setting. Each action has a Require user confirmation setting in Agent Builder. When it is on, the platform asks the user before the action runs. This is the main control, and the next chapter covers it.
- Topic instructions. You can also write confirmation wording into a topic's instructions, such as "tell the user which case will change, then ask them to confirm". This guides the model's behavior and shapes the wording of the question. It complements the setting but does not replace it, because instructions are guidance the model follows and the setting is a platform control.
The reason to use both is the drift problem above. Instructions can be missed. A setting is more dependable. Instructions improve the content of the confirmation.
Worked example: reading the risk in one action
Consider the UpdateCaseStatusAction method from the topic spine.
@InvocableMethod(
label='Update Case Status'
description='Changes the Status field of one case. This modifies data.'
)
public static List<Result> updateStatus(List<Request> requests) {
// ...
update toUpdate;
// ...
}Apply the questions:
- The method runs
update toUpdate, so it changes data. - It takes a case Id and a free-text status. The agent could pick the wrong case or invent a status string. The
Statusfield is a picklist, so an invalid value would throw a DML error, but a valid wrong value saves silently. - Closing a case may fire escalation rules, entitlement updates, or email alerts. Setting it back to Open does not recall them.
- A user who only asked a question about a case would be surprised to see it closed.
Every question points toward confirmation. This action should ask first, and the confirmation should name the case and the new status.
Exercise
A team builds three agent actions: (a) a Flow that looks up an order's shipping status, (b) an Apex method that sets an Opportunity's Stage to Closed Lost, and (c) a Flow that creates a Task on the user's own activity list. Which of them should clearly ask for confirmation first, and what two reasons from this chapter support your answer for the clearest case?
Show answer
Action (b) clearly needs confirmation. It updates data, and the agent could pick the wrong opportunity or stage from natural language. A Closed Lost change may also trigger forecast updates, automation, or notifications that are hard to undo even if the stage is reset. Action (a) only reads, so a wrong answer costs little, and confirming it would add friction and encourage confirmation fatigue. Action (c) writes, but the Task is low stakes and easy to delete, so it is a judgment call. A team can skip confirmation or ask for consistency with its other write actions.
Exercise
A user approves a confirmation that says "I will update the case." The agent had guessed the wrong case. Name two things wrong with the confirmation and say how to fix each.
Show answer
It does not name the record, so the user cannot see which case was chosen. It also does not state the new value, so the user cannot check the change. A good confirmation reads like "I will set the status of case 5001R00000AbCdE to Closed. Do you want me to go ahead?" It names the case and the new status, and it asks a question the user can answer with yes or no.