Sub topic 3
Drafting and Revising Emails with Agentforce Actions
Assume you understand Salesforce objects, fields, records, permissions, and the basics of topics and actions. This chapter focuses on how email actions fit into a larger agent conversation.
Drafting and revising emails
A standard email action creates or changes email content from conversation context. A draft action can use a customer record, case details, or Knowledge content to propose a reply. A revise action can adjust tone, length, clarity, or required details.
The agent should gather reliable context before drafting. For example, it can identify an account, query its open cases, and then draft a response using the returned information. The draft should remain separate from sending unless the design explicitly includes a send action and an appropriate confirmation step.
Combining several actions
Actions can run in sequence when one action's output supplies another action's input.
Write topic instructions that make the order explicit. For example: identify exactly one account, query current case information, then draft an email. If an action returns no record or multiple matches, ask for clarification instead of guessing.
Permissions and trust
Actions run in a Salesforce security context. Object permissions, field-level security, sharing rules, and other access controls can limit the data an agent can read or change. The Einstein Trust Layer adds controls around data handling and grounded responses, but it does not replace correct permissions.
Test with a user whose access matches the real audience. Do not assume that an administrator's successful test represents a standard user's experience.
Testing and inspection
Use Agentforce Builder's preview and testing tools to verify:
- The intended topic was selected.
- Actions ran in the expected order.
- Inputs were filled from the conversation or requested from the user.
- Outputs contained the fields needed by later actions.
- The final draft did not invent unavailable facts.
Inspect the action trace when a response is wrong. A faulty lookup, missing input, or permission failure is usually easier to fix than the final text suggests.
Standard versus custom actions
Use a standard action when its inputs, security behavior, and output meet the requirement. Choose a custom Flow, Apex, or prompt template action when you need special validation, multi-object logic, an external integration, or a precisely controlled output.
Keep custom logic narrow. A custom action increases testing and maintenance costs.
> callout note > Treat email drafts as untrusted output until a user or approved process reviews them. Confirm recipients, sensitive details, and claims about case status before sending.
Exercise
Why should an agent query a case before drafting an account-status email?
Show answer
The query supplies current, permission-checked facts and reduces the chance that the draft invents or repeats stale information.