Sub topic 9
Creating and updating records
This chapter covers the standard actions that change data: creating a record and updating a record. It assumes you know the Salesforce data model (objects, fields, records) and have added a standard action to a topic in Agentforce Builder. It also assumes you have run a lookup action first, as covered in the earlier chapter on finding and reading records.
What the change actions do
Agentforce provides two standard actions for writing data:
- Create Record inserts a new record of an object, such as a Case or a Contact.
- Update Record changes field values on an existing record.
Both run as the user who is chatting with the agent. Object permissions, field-level security, and sharing rules apply. If the user cannot edit a field, the action fails instead of writing the value.
Because these actions change data, they need more care than lookups. A wrong guess can overwrite a good value.
Inputs and outputs
Update Record needs to know which record to change and which values to write. The record usually comes from an earlier lookup action. The values come from the user's message.
| Action | Typical inputs | Typical output |
|---|---|---|
| Create Record | Object, field values | The new record ID |
| Update Record | Record ID, field values | The updated record |
The agent fills inputs through slot filling. It takes values from the conversation, and it asks the user for any required input that is still missing. In the action's configuration, describe each input clearly. A vague description leads to wrong values being passed.
Guide the agent with instructions
Instructions decide when the agent writes, and whether it checks first. The following topic text uses a confirmation step and a lookup step:
Topic: Account Support
Instructions:
1. Before updating an account, find the account record first and use its ID.
2. Restate the field and the new value, then ask the user to confirm.
3. Run the update only after the user says yes.
4. If you cannot find exactly one matching record, ask the user to clarify instead of guessing.
5. After the update, tell the user which field changed and the new value.Each rule prevents a specific failure. Step 1 stops the agent from inventing an ID. Steps 2 and 3 give the user a chance to catch mistakes. Step 4 handles duplicate names.
The flow of an update
The diagram shows a safe update conversation.
Common errors
- The update fails with a permission error. The running user lacks edit access to the record or field. Check the permission sets, not the agent.
- The agent writes the wrong value. The input description is vague, or the user's request was ambiguous. Tighten the description and add a confirmation step.
- The agent updates without asking. Nothing in the instructions requires confirmation. Add it explicitly.
- A required field is missing on create. The object's validation rules or required fields were not covered. Mention them in the instructions so the agent asks for them.
Exercise
A user says, "Change the phone number for Acme to 555-0100." Two accounts are named Acme. Which instruction keeps the agent from updating the wrong one, and what should the agent do?
Show answer
The instruction "If you cannot find exactly one matching record, ask the user to clarify instead of guessing." The agent should ask which Acme the user means. After the user clarifies, it restates the field and new value, waits for confirmation, and only then runs Update Record.