PranavNagrecha/AwesomeSalesforceSkills / skills/admin/custom-button-to-action-migration
custom-button-to-action-migration
VerifiedMigrating Classic Custom Buttons (Detail Page Buttons, List Buttons, Mass Action Buttons) and JavaScript Buttons to Lightning Quick Actions, Screen Flow Actions, LWC Quick Actions, and headless Quick Actions. Covers JavaScript-button-to-action translation patterns (sforce.apex.execute → Apex action, navigation alerts → toast events, MassAction.update → record-collection processing), URL button translation, and the irreversible loss of Classic JavaScript button capability in Lightning. NOT for new Quick Action design (use admin/global-actions-and-quick-actions) or Lightning record page composition (use admin/lightning-app-builder-advanced).
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 21.3 KB |
| references/examples.md | markdown | 9.8 KB |
| references/gotchas.md | markdown | 8.2 KB |
| references/llm-anti-patterns.md | markdown | 7.2 KB |
| references/well-architected.md | markdown | 6.9 KB |
| scripts/check_custom_button_to_action_migration.py | script | 4.7 KB |
| templates/custom-button-to-action-migration-template.md | markdown | 3.1 KB |
templates/custom-button-to-action-migration-template.md
View on GitHub# Custom Button to Action Migration — Work Template
Use this template when migrating Classic custom buttons (especially JavaScript buttons) to Lightning Quick Actions / Screen Flows / LWC Quick Actions.
---
## Scope
**Skill:** `custom-button-to-action-migration`
**Object:** _(target object)_
**Button count:**
```bash
sf data query --use-tooling-api --query \
"SELECT BehaviorType, ContentSource, COUNT(Id) FROM WebLink WHERE EntityDefinition.QualifiedApiName='Account' GROUP BY BehaviorType, ContentSource"
```
| BehaviorType | ContentSource | Count |
|---|---|---|
| Detail | OnClickJavaScript | |
| Detail | URL | |
| List | OnClickJavaScript | |
| Mass | OnClickJavaScript | |
---
## Per-Button Decision Matrix
| Button Name | Type | JS / URL Body Summary | Replacement Pattern | Notes |
|---|---|---|---|---|
| MarkHotProspect | Detail | Calls Apex, alerts, reloads | Headless LWC Quick Action (Pattern 1) | |
| OpenLinkedInLookup | Detail URL | External URL | URL Quick Action (Pattern 4) | |
| MassMarkAsKey | Mass | getRecordIds + Apex | Mass Quick Action with LWC (Pattern 3) | |
| | | | | |
Patterns: `1=Headless LWC`, `2=Screen Flow`, `3=Mass Quick Action`, `4=URL Action`, `5=Coexistence (retain Classic)`, `Retire=No replacement`.
---
## Apex Service Refactor
| Original Apex Method | Becomes | Visibility |
|---|---|---|
| (existing class).markAsHotProspect | `@AuraEnabled` static (cacheable=false) with `with sharing` + `WITH USER_MODE` | Public to LWC |
| | | |
Read idiom by the class's `.cls-meta.xml` `apiVersion` (not the org's release): 57.0+ → `WITH USER_MODE`; ≤ 56.0 → `WITH SECURITY_ENFORCED`, which was removed in 67.0 and fails to compile there.
---
## Coexistence Tracking
Add `Last_Action_Source__c` (Picklist) to the object:
| Source | Description |
|---|---|
| Classic Button | JS button invocation |
| Lightning Action | New Lightning Quick Action / LWC / Flow |
Update both Classic JS button code and the new Apex method to write this field.
---
## Adoption Goal
Retire the Classic button when:
- [ ] Adoption metric: ≥ 95% of invocations from "Lightning Action" over rolling 30 days
- [ ] OR fixed retirement date: _(YYYY-MM-DD)_
---
## Test Plan
For each migrated button:
- [ ] Functional parity in sandbox
- [ ] User acceptance: representative user from each affected profile confirms action is discoverable and works
- [ ] Mobile (iOS Salesforce App)
- [ ] Mobile (Android Salesforce App)
- [ ] Service Console subtab navigation (if applicable)
- [ ] Mass Action: tested with selection > 200 (verify chunking or user notification)
---
## Sign-Off Checklist
- [ ] Every Classic button has a documented decision: replaced, retained for Classic, or retired
- [ ] LWS-incompatible patterns removed (no `alert()`, no `confirm()`, no `sforce.*`)
- [ ] No Apex method called from LWC returns `PageReference`
- [ ] Mass Action 200-record limit handled explicitly in code/UX
- [ ] Coexistence tracking field deployed and being populated
- [ ] Mobile testing completed
- [ ] Migration audit log persisted (Custom_Button_Migration_Log__c)
- [ ] Retirement criterion documented and being measured
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation). | Stars: 323k | Updated | Claude CodeCodex | Verified | Install |
| brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK). | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |