Sub topic 4
Turning on Require user confirmation
This chapter shows how to enable the "Require user confirmation" setting on an action in Agent Builder, and what that setting does at run time. It assumes you know Salesforce objects and records, have used Agent Builder to open an agent, and understand Flow or Apex invocable methods well enough to recognize one when you see it.
What the setting does
"Require user confirmation" is a setting on a single action. When it is on, the agent pauses before it runs that action. It shows the user what it is about to do and waits for an explicit yes or no. The action runs only after the user agrees.
The setting belongs to the action, not to the agent or the topic. You turn it on for each action that needs it, and actions that only read data can stay without it.
Because the platform enforces the setting, it does not depend on the model remembering a rule written in prose. This is why it is the first control to reach for on a data-changing action. Topic instructions can reinforce it, as a later chapter explains, but they do not replace it.
Enable the setting in Agent Builder
The steps below use the Update Case Status action, built from the Apex invocable method UpdateCaseStatusAction. Menu labels can differ slightly between releases.
- In Setup, search for Agents and open your agent in Agent Builder.
- Select the topic that contains the action.
- Click the action to open its details.
- Find the Require user confirmation option and turn it on.
- Save the action, then save or activate the agent version as your org requires.
If the action is not yet in the topic, add it first. Choose the Apex invocable method, Flow, or prompt template, then give it a name and instructions. The invocable method in this tutorial carries the description "Changes the Status field of one case. This modifies data." That text helps the agent understand the action, and it also helps you spot, when you review your actions, that this one needs confirmation.
What the user sees
With the setting on, a request such as "Close case 5001R00000AbCdE" does not change the record straight away. The agent first presents the pending action and the values it collected, then waits. If the user approves, the Apex method runs and the case status changes. If the user declines, nothing is written.
The values shown come from the action's inputs. In the Apex example, caseId and newStatus are the inputs, and their labels and descriptions tell the agent what to collect. Clear labels make the confirmation easier to read, which a later chapter covers in detail.
Common errors
| Symptom | Likely cause | Fix |
|---|---|---|
| The action runs with no prompt | The setting was turned on for a different action, or the change was not saved or activated | Reopen the action, check the setting, and save the agent version you are testing |
| The prompt appears on a harmless read action | The setting was enabled on every action by habit | Turn it off for actions that only read data |
| The confirmation does not say what will change | Inputs have vague labels or descriptions | Rename the inputs and rewrite their descriptions |
| The user says yes but nothing happens | The action failed, for example on a permission or validation error | Check the user's permissions and the action's error output |
Limits of the setting
The setting asks the user once, before the action runs. It does not check whether the values are correct, whether the user is allowed to change the record, or whether the change is wise. A confirmed request with a wrong case Id still updates the wrong case.
Exercise
An agent has two actions: Get Case Details, which only queries a case, and Update Case Status, which changes the Status field. On which action should you turn on Require user confirmation, and why?
Show answer
Turn it on for Update Case Status. It modifies data, so a misunderstood request could change the wrong record or the wrong value. Get Case Details only reads data, so a confirmation prompt there adds friction without reducing risk.
Exercise
A tester reports that the agent closed a case without asking first, even though you remember enabling the setting. Name two things to check.
Show answer
First, confirm the setting is on for that specific action and not a similarly named one. Second, confirm the change was saved and that the agent version being tested is the one that includes it.