PranavNagrecha/AwesomeSalesforceSkills / skills/admin/case-feed-send-email-action
case-feed-send-email-action
VerifiedUse when configuring the outbound Send Email quick action in Lightning Case Feed — creating the action in Setup on Case (Action Type = Send Email), attaching a default Custom email template, setting predefined To/CC/BCC values, wiring QuickAction.QuickActionDefaultsHandler Apex defaults, respecting the Lightning Experience 10-file / 25 MB attachment limits, and letting agents move an email to a different case. Trigger keywords: Send Email quick action, case email composer, Email action missing from Case Feed, Don't Apply Template Subject, QuickActionDefaultsHandler, SendEmailQuickActionDefaults, move email to another case. NOT for Email-to-Case inbound routing, routing addresses, or thread-ID matching (use admin/email-to-case-configuration), NOT for authoring or migrating the templates themselves (use admin/email-templates-and-alerts and admin/classic-email-template-migration), and NOT for Apex Messaging.SingleEmailMessage sends outside Case Feed.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 22.0 KB |
| references/examples.md | markdown | 11.7 KB |
| references/gotchas.md | markdown | 6.1 KB |
| references/llm-anti-patterns.md | markdown | 8.1 KB |
| references/well-architected.md | markdown | 8.1 KB |
| scripts/check_case_feed_send_email_action.pyexecutable | script | 14.0 KB |
| templates/case-feed-send-email-action-template.md | markdown | 6.2 KB |
templates/case-feed-send-email-action-template.md
View on GitHub# Case Feed Send Email Action — Config Worksheet
Fill this out before touching Setup. Every row maps to a decision that is expensive to reverse
once agents are trained on the composer.
## Scope
**Skill:** `case-feed-send-email-action`
**Request summary:** (what the user asked for)
**Org / sandbox:**
---
## Gate 0 — Prerequisite
| Question | Answer | Blocking? |
|---|---|---|
| Is Email-to-Case enabled in the target org? | ☐ yes ☐ no | **Yes.** *"Email-to-Case must be enabled to use the Send Email quick action on the Cases object."* |
| Does a Send Email / Email action already exist on Case? | ☐ yes ☐ no | No, but a second one confuses agents — extend the existing action before adding another |
If Email-to-Case is off, stop here and route to `admin/email-to-case-configuration`.
---
## The action
| Field | Value | Notes |
|---|---|---|
| Label | | Per `templates/admin/naming-conventions.md` |
| API name | | `Case.<Name>` |
| Action Type | `Send Email` | Metadata: `<type>SendEmail</type>` (API 31.0+) |
| Intent | ☐ first touch ☐ reply | Drives the subject decision below |
## Action layout — the field contract
Mark editability deliberately. **A read-only field silently discards any prepopulated value.**
| Field | On layout? | Editable? | Prepopulated? |
|---|---|---|---|
| `ValidatedFromAddress` | ☐ | ☐ | ☐ |
| `ToAddress` | ☐ | ☐ | ☐ |
| `CcAddress` | ☐ | ☐ | ☐ |
| `BccAddress` | ☐ | ☐ | ☐ |
| `Subject` | ☐ | ☐ | ☐ |
| `HTMLBody` | ☐ | ☐ | ☐ |
| `RelatedToId` | ☐ | ☐ | ☐ (preselects the account on the case's contact when available) |
| Attachments | ☐ | — | — |
Not prepopulatable: `AttachmentId`, `ContentDocumentIds` — they aren't part of the action layout.
## Default content
| Setting | Value | Rule |
|---|---|---|
| Default Email Template | | Must be type **Custom**. *"Only Custom type templates are supported."* |
| Don't Apply Template Subject | ☐ selected ☐ cleared | **Select** for replies (keeps the customer's subject / thread). **Clear** for first touch. |
| Predefined field values | | ID fields (`Contact.Id`) or string fields; Contact, lead, person-account IDs supported |
> The Metadata API `QuickAction` docs do not list a template field. Re-verify Default Email
> Template after every deployment and org refresh.
---
## Defaulting mechanism — pick one
| | Declarative | Apex handler |
|---|---|---|
| Chosen | ☐ | ☐ |
| Use when | Same template + recipients every send | Template/BCC varies by case, or reply vs. first touch |
| Cost | None | Org-wide synchronous Apex, test class, deployment per change |
If Apex, the skeleton — see `references/examples.md` for the complete class:
```apex
global class <Name> implements QuickAction.QuickActionDefaultsHandler {
global <Name>() {} // required: empty, parameterless
global void onInitDefaults(QuickAction.QuickActionDefaults[] defaults) {
for (QuickAction.QuickActionDefaults qad : defaults) {
if (qad instanceof QuickAction.SendEmailQuickActionDefaults
&& qad.getTargetSObject().getSObjectType() == EmailMessage.sObjectType
&& qad.getActionName().equals('Case.Email')
&& qad.getActionType().equals('Email')) {
QuickAction.SendEmailQuickActionDefaults d =
(QuickAction.SendEmailQuickActionDefaults) qad;
// one bounded query on d.getContextId(); branch on d.getInReplyToId()
break;
}
}
}
}
```
Constraints: one bounded SOQL per init, CRUD/FLS via `templates/apex/SecurityUtils.cls`, fail
soft and log via `templates/apex/ApplicationLogger.cls`.
---
## Layout assignment
List **every** Case page layout a support persona sees. Missing one removes the composer for
that whole team with no error.
| Case page layout | Assigned to (profile / record type) | Action added? |
|---|---|---|
| | | ☐ |
| | | ☐ |
## If the *standard* Email action is the one missing
Not a layout problem. Walk the three causes the troubleshooting article documents:
| Check | Setting | Cleared? |
|---|---|---|
| Email deliverability access level is **All email**, not **System Email Only** | Setup → Deliverability | ☐ |
| Email-to-Case is enabled (irreversible once on) | Setup → Email-to-Case | ☐ |
| **Enable Case Feed Actions and Feed Items** is selected | Setup → Support Settings | ☐ |
| Agents sending via Office 365 / Gmail have the matching permission set | | ☐ |
## Move-email capability
| Question | Answer |
|---|---|
| Should agents be able to move an email to a different case? | ☐ yes ☐ no |
| Precondition: emails were created by Email-to-Case | ☐ confirmed |
| Precondition: email threading is set to **Lightning threading** | ☐ confirmed |
| Enabled via | Salesforce Help, *"Let Agents Move Emails to a Different Case"* (an admin setting — no user permission is documented for this) |
| Move volume monitored as a routing-defect signal? | ☐ yes |
---
## Agent enablement
- [ ] Agents briefed on the attachment limits for **their UI** — Lightning Experience: 10 files, 25 MB total file size; Salesforce Classic: more than 10 files, 18 MB total
- [ ] Agents told that no per-attachment size cap is documented, so the total is the budget
- [ ] Agents shown the move-email path instead of re-sending from the correct case
---
## Validation
```bash
python3 scripts/check_case_feed_send_email_action.py --manifest-dir force-app/main/default
```
Then send a real test email, reply to it, and confirm the subject, template body, and BCC behave
as designed.
## Sign-off checklist
- [ ] Email-to-Case enabled
- [ ] Action type is `SendEmail`; label follows naming conventions
- [ ] Default Email Template is a **Custom**-type template
- [ ] Don't Apply Template Subject matches the action's intent
- [ ] No prepopulated field is read-only on the layout
- [ ] No predefined value targets `AttachmentId` / `ContentDocumentIds`
- [ ] Action present on every relevant Case page layout
- [ ] Any Apex handler: `global`, empty constructor, filters on `Case.Email`, bounded SOQL
- [ ] Checker script passes
- [ ] No GA / Beta / Pilot claim in any deliverable — the official docs make none
## Notes
(Record any deviation from the standard pattern and why.)
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 323k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 323k | Updated | Claude CodeCodex | Verified | Install |
| executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available | Stars: 323k | Updated | Claude CodeCodex | Verified | Install |