* ci: update package details and add GitHub workflows for skills validation and release * chore: update Node version, change license, and refactor skills validation script to TypeScript * chore: remove unused deps * fix: npm package * fix: flatten skills to pass validation * chore: add validation script to package.json and update GitHub workflow to use it * chore: enhance skills validation and update workflows for npm publishing * refactor: streamline skills validation process in workflow and script * refactor: improve documentation and structure of skills validation script * implement checks based on jeff's best practices doc * chore: add pull request template for skill submissions * chore: update pull request template with additional references and improve automated checks section * chore: update pull request template to clarify naming convention with a warning for gerund form * chore: update pull request template to reference skill authoring guide and enhance checklist structure * chore: enhance GitHub workflows for skills validation and release process * refactor: improve parsing logic for SKILL.md files and enhance error collection in validation * chore: update validation checks to enforce character limits for skill names and descriptions * fix: remove unnecessary whitespace in footer string in validate-skills.ts
8.2 KiB
Rollback Procedures
This guide provides step-by-step instructions for rolling back a Salesforce deployment if issues are discovered after release.
When to Rollback
Execute a rollback when:
- Critical functionality is broken and cannot be hotfixed quickly
- Data integrity issues are discovered
- Performance degradation exceeds 50% of baseline
- Security vulnerabilities are introduced
- Stakeholder approval to rollback is obtained
Do NOT rollback for:
- Minor UI issues that don't impact functionality
- Issues that can be hotfixed in < 2 hours
- Edge cases affecting < 5% of users
- Cosmetic problems
Pre-Rollback Checklist
Before initiating rollback:
- Confirm the issue severity justifies rollback
- Obtain stakeholder approval
- Notify all users of upcoming rollback
- Backup current production state (post-deployment)
- Verify pre-deployment backup is available
- Review rollback plan with team
- Prepare communication for completion
Rollback Methods
Method 1: Redeploy Previous Version (Recommended)
Best for: Metadata-only deployments with no data changes.
Steps:
-
Retrieve pre-deployment state from version control:
git checkout pre-deployment-YYYYMMDD -
Validate rollback deployment:
sf project deploy validate \ --manifest manifest/package.xml \ --test-level RunLocalTests \ --target-org production -
Deploy previous version:
sf project deploy start \ --manifest manifest/package.xml \ --test-level RunLocalTests \ --target-org production -
Verify rollback:
- Test critical user flows
- Check for errors in debug logs
- Confirm with stakeholders
Timeline: 30-60 minutes
Method 2: Selective Component Rollback
Best for: When only specific components are problematic.
Steps:
-
Identify problematic components:
- Review error logs
- Isolate failing functionality
- List components to rollback
-
Create targeted package.xml:
<?xml version="1.0" encoding="UTF-8"?> <Package xmlns="http://soap.sforce.com/2006/04/metadata"> <types> <members>ProblematicClass</members> <name>ApexClass</name> </types> <version>59.0</version> </Package> -
Retrieve previous version of components:
git show pre-deployment-YYYYMMDD:force-app/main/default/classes/ProblematicClass.cls > temp/ProblematicClass.cls -
Deploy only those components:
sf project deploy start \ --manifest rollback-package.xml \ --target-org production
Timeline: 15-30 minutes
Method 3: Destructive Changes
Best for: When new components must be removed entirely.
Steps:
-
Create destructiveChanges.xml:
<?xml version="1.0" encoding="UTF-8"?> <Package xmlns="http://soap.sforce.com/2006/04/metadata"> <types> <members>NewComponentToDelete</members> <name>ApexClass</name> </types> <version>59.0</version> </Package> -
Create empty package.xml:
<?xml version="1.0" encoding="UTF-8"?> <Package xmlns="http://soap.sforce.com/2006/04/metadata"> <version>59.0</version> </Package> -
Deploy destructive changes:
sf project deploy start \ --manifest package.xml \ --pre-destructive-changes destructiveChanges.xml \ --test-level RunLocalTests \ --target-org production -
Verify deletion:
sf org list metadata --metadata-type ApexClass --target-org production
Timeline: 20-40 minutes
Data Rollback Considerations
If the deployment included data changes:
Option A: Restore from Backup
-
Locate pre-deployment data backup:
- Data Export Service snapshot
- Backup tool (OwnBackup, Spanning, etc.)
- Manual CSV exports
-
Restore data:
sf data import tree --plan data-backup/data-plan.json --target-org production -
Validate data integrity:
- Run data quality checks
- Verify record counts
- Check relationships
Timeline: 1-4 hours (depending on data volume)
Option B: Reverse Data Changes (Scripted)
-
Identify affected records:
sf data query --query "SELECT Id FROM Account WHERE LastModifiedDate >= YESTERDAY" -
Apply reverse operations:
- Create Apex script to reverse changes
- Test in sandbox first
- Execute in production
Timeline: 2-6 hours
Post-Rollback Steps
After rollback is complete:
-
Verify Functionality:
- Execute smoke tests
- Confirm critical workflows work
- Check automation (triggers, flows) operates correctly
- Review debug logs for errors
-
Communication:
- Notify users rollback is complete
- Send post-mortem summary to stakeholders
- Update status page / internal wiki
-
Root Cause Analysis:
- Document what went wrong
- Identify why issues weren't caught pre-deployment
- Update deployment checklist to prevent recurrence
- Schedule retrospective with team
-
Next Steps:
- Fix issues in development environment
- Add test cases to catch similar issues
- Re-validate deployment in sandbox
- Schedule new deployment with fixes
Emergency Contacts
Production Issues:
- On-call DevOps: [contact info]
- Salesforce Support: [premier support phone]
- Release Manager: [contact info]
Stakeholder Notifications:
- Product Owner: [contact info]
- Business Analyst: [contact info]
- Executive Sponsor: [contact info]
Rollback Decision Matrix
| Severity | Impact | Rollback? | Timeline |
|---|---|---|---|
| Critical | >50% users affected, core functionality broken | Yes | Immediate (< 1 hour) |
| High | 10-50% users affected, workaround exists | Consider | Within 2-4 hours |
| Medium | <10% users affected, non-critical features | No, hotfix instead | Plan fix for next release |
| Low | Edge case, cosmetic issues | No | Address in backlog |
Lessons Learned Template
After each rollback, document lessons learned:
# Rollback Post-Mortem: [Date]
## Deployment Summary
- Deployment date/time: [timestamp]
- Components deployed: [list]
- Rollback date/time: [timestamp]
- Rollback method used: [method]
## Issue Description
[Describe what went wrong]
## Root Cause
[Why did the issue occur?]
## Detection
- How was the issue discovered?
- How long after deployment?
- Who reported it?
## Impact
- Number of users affected: [count]
- Business processes impacted: [list]
- Duration of impact: [timespan]
## Resolution
- Rollback timeline: [start - end]
- Additional fixes required: [list]
## Prevention
- What tests would have caught this?
- Process improvements needed:
- Deployment checklist updates:
## Action Items
- [ ] [Action item with owner]
- [ ] [Action item with owner]
Best Practices
- Practice rollbacks in sandbox - Don't wait for an emergency to learn the process
- Maintain detailed backups - Automate metadata and data backups before every deployment
- Use version control tags - Tag every production deployment for easy identification
- Document everything - Keep a deployment log with timestamps and decisions
- Communicate proactively - Keep stakeholders informed throughout the process
- Set time limits - If rollback takes >2 hours, consider alternative approaches
- Test the rollback - Validate in sandbox that the rollback process works
Rollback Scripts Repository
Keep commonly-used rollback scripts in version control:
scripts/rollback/
├── rollback-apex.sh # Rollback Apex classes
├── rollback-lwc.sh # Rollback Lightning Web Components
├── rollback-flows.sh # Rollback flows and processes
├── rollback-data.sh # Restore data from backup
└── verify-rollback.sh # Post-rollback verification
Testing Rollback Procedures
Quarterly rollback drill:
- Deploy a test change to sandbox
- Wait 1 hour
- Execute full rollback procedure
- Time the process
- Document any issues
- Update procedures as needed
This ensures the team is prepared when a real rollback is needed.