Sub topic 11
Drafting and revising emails
This chapter covers the standard email action. It assumes you can add a standard action to a topic in Agentforce Builder and that you know how record lookup actions pass a record to later steps. It also assumes you know what topic instructions are.
What the email action does
Agentforce provides a standard action that drafts a new email or revises an existing draft. In Builder it appears as Draft or Revise Email. The exact name can vary by release, so check the action list in your org.
The action produces email text. A large language model writes it from the context the agent supplies. The action does not send anything. The user reviews the text, and any sending happens in a separate step that you design.
Inputs and outputs
The action needs a few pieces of information, and the agent fills them from the conversation or from earlier action results.
| Input | Purpose |
|---|---|
| Instructions or goal | What the email should say, such as "follow up on the renewal quote" |
| Related record | The record that grounds the draft, such as an Account or Opportunity |
| Existing draft (for revisions) | The text to change |
| Tone or length request | Optional style guidance from the user |
The output is the drafted or revised email body, which the agent shows in the conversation. Grounding the draft in a record matters. Without one, the model has only the user's words and tends to write generic text.
Where it fits in a conversation
Drafting usually comes after a lookup. The agent finds the record, then uses it to write the email.
Writing topic instructions for email
The agent decides when to call the action based on your topic instructions. Spell out the order, the grounding, and the confirmation step.
Topic: Customer Follow-Up
Classification description:
Help the user write follow-up emails to customers.
Instructions:
1. When the user names an account, first find the account record, then use it as the related record for the draft.
2. Use the draft email action to write the first version. Do not write the email text yourself.
3. When the user asks for changes, revise the existing draft instead of starting over.
4. Never say an email was sent. Tell the user the draft is ready to copy or send.Instruction 2 keeps the agent from writing text on its own and skipping the action. Instruction 4 stops the agent from claiming a send that never happened.
Common errors
- Generic drafts. The agent skipped the lookup, so the action had no record. Add an instruction that requires finding the record first.
- Revisions that restart. The agent calls the draft path again without the prior text. Tell it to revise the existing draft.
- Claiming the email was sent. The action only drafts. Say so in the instructions.
- Wrong record. If the name matches several records, ask the user to clarify instead of guessing.
The action runs on behalf of the user. The agent can only use record data that user is allowed to see.
Exercise
A user says "Write a follow-up to Acme about the open quote." The agent returns a vague email with no quote details. Which two changes to the topic instructions are most likely to fix it?
Show answer
First, require the agent to find the Acme record (and the related quote or Opportunity) before drafting, so the draft action receives a related record. Second, tell the agent to use the draft action for the text instead of writing the email itself. Also tell it to ask the user to clarify if more than one record matches.