Sub topic 7
Referencing Actions and Stating When to Use Them
This chapter covers how to name actions in topic instructions and say when each one runs. It assumes you can open Agentforce Builder, you know that a topic can have actions assigned to it, and you have written basic instructions for a topic.
Why instructions need to mention actions
An action is a unit of work the agent can run, such as a Flow, an Apex method, or a prompt template. Assigning an action to a topic makes it available. It does not tell the agent when to use it. The agent decides from the action's own description and from your instructions.
If your instructions say nothing about an action, the agent may skip it and answer from general knowledge. It may also call it at the wrong moment. A short, explicit reference in the instructions removes that guesswork.
The pattern: condition, action, inputs
A reliable instruction has three parts:
- A condition that says when the instruction applies.
- The exact name of the action to use.
- The input the action needs, or what to do with its result.
If the customer asks for the status of an order, use the Get Order Status action with the order number.
If the customer asks to return an item, tell them you can't process returns in this topic and offer to transfer them to a human agent.Get Order Status is a hypothetical name. Use the exact name of an action assigned to your topic. If the name in your instruction differs from the name in the action list, the agent may not connect the two.
The second line shows that a condition does not always lead to an action. Sometimes the right behavior is to decline and redirect. State that outcome directly.
Order the steps when sequence matters
Some actions depend on information from earlier steps. Number the steps so the agent does them in order.
1. Ask the customer for their order number if they have not provided one.
2. Use the Get Order Status action with the order number before describing its status.
3. Give the current status and the expected delivery date in one or two sentences.
4. If the action returns no order, say so and ask the customer to check the number. Do not guess a status.Step 2 places the lookup before the answer. Step 4 covers the failure case. Without step 4, the agent might invent a plausible status when the lookup returns nothing.
Flow of a single request
The diagram shows how the instructions guide one request through the topic.
Common mistakes with action references
| Mistake | Example | Fix |
|---|---|---|
| Vague reference | "Look things up when needed." | Name the action and the condition. |
| Wrong action name | "Use the Order Lookup action" when the action is Get Order Status | Copy the exact name from the topic's action list. |
| No input stated | "Use Get Order Status." | Add "with the order number". |
| No failure path | Nothing about empty results | Say what to do when the action returns nothing or fails. |
| Action not assigned | The instruction names an action that is not on the topic | Assign the action to the topic, or remove the reference. |
Keep each condition to one behavior
Avoid stacking several outcomes on one condition. "If the customer asks about an order, look it up, apologize if it is late, offer a coupon, and escalate" gives the agent four things to juggle, and it may drop some. Split it into separate conditions, each with one expected behavior. Then you can test each one on its own.
Also check that two conditions cannot both be true for the same message with different results. That is the conflicting-instructions problem, which a later chapter covers.
Check that it works
Open Agentforce Builder and preview a conversation. Try three messages:
- A request with the order number included. Confirm the action runs without a second question.
- A request without a number. Confirm the agent asks for it first.
- A request that is out of scope, such as a return. Confirm the agent declines and offers a transfer.
In the preview, inspect which action ran and what input it received. If the wrong action ran, or none did, revise the condition wording or the action name.
Exercise
A topic has an assigned action named Check Warranty. A teammate wrote the instruction "Help customers with warranty questions." The agent often answers from memory and never runs the action. Rewrite the instruction so the agent reliably uses the action, and add a case for when nothing is found.
Show answer
Example: "If the customer asks whether a product is under warranty, ask for the product serial number if they have not given one. Then use the Check Warranty action with the serial number before answering. If the action finds no record, say so and ask the customer to check the serial number. Do not guess the warranty status." This names the condition, the exact action, the input, the order of steps, and the failure path.
Exercise
Why can an instruction that names an action still fail to run it?
Show answer
The name may not match the assigned action exactly, or the action may not be assigned to the topic. The condition may also be vague, or conflict with another instruction.