Sub topic 9
Adding standard actions
This chapter assumes you have created an agent in Agentforce Builder and defined at least one topic with instructions. You should know basic Salesforce objects and the Setup menu. No Apex is needed here.
What a standard action is
An action is a unit of work that an agent can run. The topic's instructions tell the agent when to run it. A standard action is an action that Salesforce ships with the platform, so you configure it instead of writing code. Examples include actions that query records, update records, summarize a record, and draft an email.
Standard actions sit next to the other two kinds you will meet later in this tutorial: custom Apex actions and prompt template actions. All three appear in the same list in the builder, and the agent treats them the same way.
Add an action to a topic
Actions belong to a topic. An agent can only use the actions attached to the topic it has selected for the current request.
- Open your agent in Agentforce Builder.
- Select the topic, for example Case Status Questions.
- Open the topic's Actions section and choose to add an action.
- Pick the action from the list of standard actions, and confirm.
- Review the action's name and description, then save.
If the action you want is missing, check that you are in the right topic and that the org has the required feature enabled. Section "Common problems" below covers more causes.
Names and descriptions drive selection
The agent does not read your action's code. It reads the action's name, its description, and the labels of its inputs and outputs. It uses these to decide whether the action fits the request. Vague text leads to the wrong action, or no action at all.
| Weak | Better |
|---|---|
| Get info | Look up the status and priority of a case by case number |
| Update | Change the status of a case the user names |
| Input: value | Input: Case number, for example 00001026 |
Edit the description in the builder when the default text is generic. Keep it to what the action does and what it needs.
Connect actions to instructions
Instructions should name the action and say when to use it. Compare these two lines.
Weak: Help the user with cases.
Better: When the user asks about a case, use the Query Records action to find the case by number. If it returns no record, say so.The second version gives the agent a trigger, a tool, and a fallback. Refer to the action by the same name that appears in the builder, so the instruction and the action are an obvious match.
Inputs and outputs
Each action declares inputs it needs and outputs it returns. For each input, the builder lets you decide how it gets its value. The agent can ask the user for it, take it from the conversation, or use a fixed value. Choose carefully. A required input the agent cannot collect will stall the action.
Outputs are what the agent can use in its reply. Mark only the outputs the agent needs. Extra output gives the agent more text to work through and can add noise.
Access and safety
An action runs with the access of the agent's user, not the access of a person who set it up. If the agent's user lacks read access to Case, a query action returns nothing, even though the configuration looks correct. Give the agent user the permissions that the action needs, as covered in the permissions chapter.
Common problems
- The action is not listed. Confirm that you opened the correct topic and that the related feature is enabled in Setup.
- The agent never calls the action. Rewrite the description and the instruction so that they use the same words as the user's likely request.
- The action runs but returns nothing. Check object and field access for the agent's user.
- The agent asks for a value you wanted filled in. Change that input to use a fixed value or a value from the conversation.
You will check each of these in the conversation preview in a later chapter.
Exercise
A topic includes the Query Records action, but in the preview the agent answers case questions from guesses and never runs the action. Name two changes you can make in the builder to fix this.
Show answer
First, add an instruction that names the action and says when to use it, such as "When the user asks about a case, use Query Records to find it." Second, rewrite the action's description so it states what it does in the same terms users use, such as looking up a case's status by case number. Checking that the action is attached to the selected topic is also valid.
Exercise
An action is attached and called correctly, but it always returns no records. The configuration looks right. What should you check first?
Show answer
Check the agent user's permissions. The action runs with that user's access, so missing read access to the object or its fields produces empty results.