@salesforce/afv-skills 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.txt +330 -0
- package/README.md +466 -0
- package/package.json +23 -0
- package/skills/apex-class/SKILL.md +253 -0
- package/skills/apex-class/examples/AccountDeduplicationBatch.cls +148 -0
- package/skills/apex-class/examples/AccountSelector.cls +193 -0
- package/skills/apex-class/examples/AccountService.cls +201 -0
- package/skills/apex-class/templates/abstract.cls +128 -0
- package/skills/apex-class/templates/batch.cls +125 -0
- package/skills/apex-class/templates/domain.cls +102 -0
- package/skills/apex-class/templates/dto.cls +108 -0
- package/skills/apex-class/templates/exception.cls +51 -0
- package/skills/apex-class/templates/interface.cls +25 -0
- package/skills/apex-class/templates/queueable.cls +92 -0
- package/skills/apex-class/templates/schedulable.cls +75 -0
- package/skills/apex-class/templates/selector.cls +92 -0
- package/skills/apex-class/templates/service.cls +69 -0
- package/skills/apex-class/templates/utility.cls +97 -0
- package/skills/apex-test-class/SKILL.md +101 -0
- package/skills/apex-test-class/references/assertion-patterns.md +209 -0
- package/skills/apex-test-class/references/async-testing.md +276 -0
- package/skills/apex-test-class/references/mocking-patterns.md +219 -0
- package/skills/apex-test-class/references/test-data-factory.md +176 -0
- package/skills/deployment-readiness-check/SKILL.md +257 -0
- package/skills/deployment-readiness-check/assets/deployment_checklist.md +286 -0
- package/skills/deployment-readiness-check/references/rollback_procedures.md +308 -0
- package/skills/deployment-readiness-check/scripts/check_metadata.sh +207 -0
- package/skills/salesforce-custom-application/SKILL.md +211 -0
- package/skills/salesforce-custom-field/SKILL.md +505 -0
- package/skills/salesforce-custom-lightning-type/SKILL.md +157 -0
- package/skills/salesforce-custom-object/SKILL.md +238 -0
- package/skills/salesforce-custom-tab/SKILL.md +78 -0
- package/skills/salesforce-experience-site/SKILL.md +178 -0
- package/skills/salesforce-flexipage/SKILL.md +445 -0
- package/skills/salesforce-flow/SKILL.md +368 -0
- package/skills/salesforce-fragment/SKILL.md +42 -0
- package/skills/salesforce-lightning-app-build/SKILL.md +254 -0
- package/skills/salesforce-list-view/SKILL.md +216 -0
- package/skills/salesforce-validation-rule/SKILL.md +72 -0
- package/skills/salesforce-web-app-creating-records/SKILL.md +84 -0
- package/skills/salesforce-web-app-feature/SKILL.md +70 -0
- package/skills/salesforce-web-app-list-and-create-records/SKILL.md +36 -0
- package/skills/salesforce-web-application/SKILL.md +34 -0
- package/skills/trigger-refactor-pipeline/SKILL.md +191 -0
- package/skills/trigger-refactor-pipeline/assets/test_template.apex +321 -0
- package/skills/trigger-refactor-pipeline/references/handler_patterns.md +442 -0
- package/skills/trigger-refactor-pipeline/scripts/analyze_trigger.py +258 -0
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
# TestDataFactory Patterns
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
TestDataFactory is a centralized utility class for creating test records with sensible defaults. It ensures consistent test data across all test classes and reduces duplication.
|
|
6
|
+
|
|
7
|
+
## Base Template
|
|
8
|
+
|
|
9
|
+
```apex
|
|
10
|
+
@IsTest
|
|
11
|
+
public class TestDataFactory {
|
|
12
|
+
|
|
13
|
+
// ============ ACCOUNTS ============
|
|
14
|
+
|
|
15
|
+
public static List<Account> createAccounts(Integer count, Boolean doInsert) {
|
|
16
|
+
List<Account> accounts = new List<Account>();
|
|
17
|
+
for (Integer i = 0; i < count; i++) {
|
|
18
|
+
accounts.add(new Account(
|
|
19
|
+
Name = 'Test Account ' + i,
|
|
20
|
+
BillingStreet = '123 Test St',
|
|
21
|
+
BillingCity = 'San Francisco',
|
|
22
|
+
BillingState = 'CA',
|
|
23
|
+
BillingPostalCode = '94105',
|
|
24
|
+
BillingCountry = 'USA',
|
|
25
|
+
Industry = 'Technology',
|
|
26
|
+
Type = 'Customer'
|
|
27
|
+
));
|
|
28
|
+
}
|
|
29
|
+
if (doInsert) insert accounts;
|
|
30
|
+
return accounts;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
public static Account createAccount(Boolean doInsert) {
|
|
34
|
+
return createAccounts(1, doInsert)[0];
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// ============ CONTACTS ============
|
|
38
|
+
|
|
39
|
+
public static List<Contact> createContacts(List<Account> accounts, Integer countPerAccount, Boolean doInsert) {
|
|
40
|
+
List<Contact> contacts = new List<Contact>();
|
|
41
|
+
Integer index = 0;
|
|
42
|
+
for (Account acc : accounts) {
|
|
43
|
+
for (Integer i = 0; i < countPerAccount; i++) {
|
|
44
|
+
contacts.add(new Contact(
|
|
45
|
+
FirstName = 'Test',
|
|
46
|
+
LastName = 'Contact ' + index,
|
|
47
|
+
Email = 'test.contact' + index + '@example.com',
|
|
48
|
+
Phone = '555-000-' + String.valueOf(index).leftPad(4, '0'),
|
|
49
|
+
AccountId = acc.Id
|
|
50
|
+
));
|
|
51
|
+
index++;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
if (doInsert) insert contacts;
|
|
55
|
+
return contacts;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// ============ OPPORTUNITIES ============
|
|
59
|
+
|
|
60
|
+
public static List<Opportunity> createOpportunities(List<Account> accounts, Integer countPerAccount, Boolean doInsert) {
|
|
61
|
+
List<Opportunity> opps = new List<Opportunity>();
|
|
62
|
+
Integer index = 0;
|
|
63
|
+
for (Account acc : accounts) {
|
|
64
|
+
for (Integer i = 0; i < countPerAccount; i++) {
|
|
65
|
+
opps.add(new Opportunity(
|
|
66
|
+
Name = 'Test Opportunity ' + index,
|
|
67
|
+
AccountId = acc.Id,
|
|
68
|
+
StageName = 'Prospecting',
|
|
69
|
+
CloseDate = Date.today().addDays(30),
|
|
70
|
+
Amount = 10000 + (index * 1000)
|
|
71
|
+
));
|
|
72
|
+
index++;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
if (doInsert) insert opps;
|
|
76
|
+
return opps;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// ============ USERS ============
|
|
80
|
+
|
|
81
|
+
public static User createUser(String profileName, Boolean doInsert) {
|
|
82
|
+
Profile p = [SELECT Id FROM Profile WHERE Name = :profileName LIMIT 1];
|
|
83
|
+
String uniqueKey = String.valueOf(DateTime.now().getTime());
|
|
84
|
+
|
|
85
|
+
User u = new User(
|
|
86
|
+
FirstName = 'Test',
|
|
87
|
+
LastName = 'User ' + uniqueKey,
|
|
88
|
+
Email = 'testuser' + uniqueKey + '@example.com',
|
|
89
|
+
Username = 'testuser' + uniqueKey + '@example.com.test',
|
|
90
|
+
Alias = 'tuser',
|
|
91
|
+
TimeZoneSidKey = 'America/Los_Angeles',
|
|
92
|
+
LocaleSidKey = 'en_US',
|
|
93
|
+
EmailEncodingKey = 'UTF-8',
|
|
94
|
+
LanguageLocaleKey = 'en_US',
|
|
95
|
+
ProfileId = p.Id
|
|
96
|
+
);
|
|
97
|
+
if (doInsert) insert u;
|
|
98
|
+
return u;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// ============ CUSTOM OBJECTS ============
|
|
102
|
+
|
|
103
|
+
// Add methods for your custom objects following the same pattern:
|
|
104
|
+
// public static List<MyObject__c> createMyObjects(Integer count, Boolean doInsert) { ... }
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Field Override Pattern
|
|
109
|
+
|
|
110
|
+
Allow callers to override default values:
|
|
111
|
+
|
|
112
|
+
```apex
|
|
113
|
+
public static Account createAccount(Map<String, Object> fieldOverrides, Boolean doInsert) {
|
|
114
|
+
Account acc = new Account(
|
|
115
|
+
Name = 'Test Account',
|
|
116
|
+
Industry = 'Technology'
|
|
117
|
+
);
|
|
118
|
+
|
|
119
|
+
// Apply overrides
|
|
120
|
+
for (String fieldName : fieldOverrides.keySet()) {
|
|
121
|
+
acc.put(fieldName, fieldOverrides.get(fieldName));
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
if (doInsert) insert acc;
|
|
125
|
+
return acc;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// Usage:
|
|
129
|
+
Account acc = TestDataFactory.createAccount(new Map<String, Object>{
|
|
130
|
+
'Name' => 'Custom Name',
|
|
131
|
+
'Industry' => 'Healthcare'
|
|
132
|
+
}, true);
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## Handling Required Fields and Validation Rules
|
|
136
|
+
|
|
137
|
+
```apex
|
|
138
|
+
public static Account createAccountWithRequiredFields(Boolean doInsert) {
|
|
139
|
+
Account acc = new Account(
|
|
140
|
+
Name = 'Test Account',
|
|
141
|
+
// Required custom fields
|
|
142
|
+
External_Id__c = 'EXT-' + String.valueOf(DateTime.now().getTime()),
|
|
143
|
+
// Fields required by validation rules
|
|
144
|
+
Phone = '555-123-4567',
|
|
145
|
+
Website = 'https://example.com'
|
|
146
|
+
);
|
|
147
|
+
if (doInsert) insert acc;
|
|
148
|
+
return acc;
|
|
149
|
+
}
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
## Record Type Support
|
|
153
|
+
|
|
154
|
+
```apex
|
|
155
|
+
public static Account createAccountByRecordType(String recordTypeName, Boolean doInsert) {
|
|
156
|
+
Id recordTypeId = Schema.SObjectType.Account
|
|
157
|
+
.getRecordTypeInfosByDeveloperName()
|
|
158
|
+
.get(recordTypeName)
|
|
159
|
+
.getRecordTypeId();
|
|
160
|
+
|
|
161
|
+
Account acc = new Account(
|
|
162
|
+
Name = 'Test Account',
|
|
163
|
+
RecordTypeId = recordTypeId
|
|
164
|
+
);
|
|
165
|
+
if (doInsert) insert acc;
|
|
166
|
+
return acc;
|
|
167
|
+
}
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
## Best Practices
|
|
171
|
+
|
|
172
|
+
1. **Always include doInsert parameter** - Allows flexibility for tests that need to modify records before insert
|
|
173
|
+
2. **Use unique identifiers** - Include index or timestamp in Name/Email fields to avoid duplicates
|
|
174
|
+
3. **Set all required fields** - Include all fields required by validation rules
|
|
175
|
+
4. **Return the created records** - Enables chaining and further manipulation
|
|
176
|
+
5. **Create bulk methods first** - Single record methods should call bulk methods with count=1
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: deployment-readiness-check
|
|
3
|
+
description: Comprehensive pre-deployment validation checklist for Salesforce releases. Use before deploying to production to catch metadata issues, test coverage gaps, and configuration errors.
|
|
4
|
+
license: Apache-2.0
|
|
5
|
+
compatibility: Requires Salesforce CLI, jq, bash
|
|
6
|
+
metadata:
|
|
7
|
+
author: afv-library
|
|
8
|
+
version: "1.0"
|
|
9
|
+
allowed-tools: Bash Read
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## When to Use This Skill
|
|
13
|
+
|
|
14
|
+
Use this skill before deploying Salesforce metadata to production (or higher environments) to:
|
|
15
|
+
- Validate metadata quality and completeness
|
|
16
|
+
- Check test coverage meets organizational standards
|
|
17
|
+
- Verify security settings and permissions
|
|
18
|
+
- Identify configuration issues before deployment
|
|
19
|
+
- Generate deployment documentation
|
|
20
|
+
|
|
21
|
+
## Prerequisites
|
|
22
|
+
|
|
23
|
+
- Salesforce CLI installed and authenticated to target org
|
|
24
|
+
- `jq` command-line JSON processor installed
|
|
25
|
+
- Bash shell (Linux, macOS, or WSL on Windows)
|
|
26
|
+
- Source metadata in SFDX project format
|
|
27
|
+
|
|
28
|
+
## Step 1: Run Metadata Validation
|
|
29
|
+
|
|
30
|
+
Execute the validation script to check for common metadata issues:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
bash scripts/check_metadata.sh
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
The script validates:
|
|
37
|
+
- **Metadata format** - Ensures all XML is well-formed
|
|
38
|
+
- **API versions** - Checks for outdated API versions
|
|
39
|
+
- **Deprecated features** - Identifies deprecated components
|
|
40
|
+
- **Naming conventions** - Validates standard naming patterns
|
|
41
|
+
- **File completeness** - Ensures meta.xml files are present
|
|
42
|
+
|
|
43
|
+
Review the output for any warnings or errors before proceeding.
|
|
44
|
+
|
|
45
|
+
## Step 2: Verify Test Coverage
|
|
46
|
+
|
|
47
|
+
Check that your Apex test coverage meets organizational standards:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
# Run all tests and generate coverage report
|
|
51
|
+
sf apex test run --test-level RunLocalTests --result-format human --code-coverage --wait 10
|
|
52
|
+
|
|
53
|
+
# Check coverage percentage
|
|
54
|
+
sf apex get test --test-run-id <test-run-id> --code-coverage --result-format json | jq '.summary.testRunCoverage'
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
**Minimum requirements**:
|
|
58
|
+
- Overall org coverage: ≥75% (Salesforce minimum)
|
|
59
|
+
- Individual class coverage: ≥75% (recommended)
|
|
60
|
+
- No classes with 0% coverage
|
|
61
|
+
|
|
62
|
+
If coverage is below threshold:
|
|
63
|
+
1. Identify uncovered classes using the coverage report
|
|
64
|
+
2. Add test methods to increase coverage
|
|
65
|
+
3. Rerun tests until requirements are met
|
|
66
|
+
|
|
67
|
+
## Step 3: Security and Permissions Review
|
|
68
|
+
|
|
69
|
+
Review security settings and permissions to ensure proper access controls:
|
|
70
|
+
|
|
71
|
+
1. **Profile and Permission Set Review**
|
|
72
|
+
- Check that custom profiles/permission sets follow least-privilege principle
|
|
73
|
+
- Verify admin permissions are not granted to standard users
|
|
74
|
+
- Ensure sensitive objects have appropriate FLS
|
|
75
|
+
|
|
76
|
+
2. **Sharing Rules and OWD**
|
|
77
|
+
- Review Organization-Wide Defaults are appropriate
|
|
78
|
+
- Validate sharing rules grant necessary access without over-sharing
|
|
79
|
+
- Check for public groups with excessive membership
|
|
80
|
+
|
|
81
|
+
3. **API Access**
|
|
82
|
+
- Verify Connected Apps have appropriate scopes
|
|
83
|
+
- Check Named Credentials use secure authentication
|
|
84
|
+
- Review Remote Site Settings are necessary
|
|
85
|
+
|
|
86
|
+
Consult the [security checklist reference](references/security_checklist.md) for detailed guidance.
|
|
87
|
+
|
|
88
|
+
## Step 4: Configuration Validation
|
|
89
|
+
|
|
90
|
+
Verify configuration settings are deployment-ready:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
# Check for hardcoded URLs or IDs
|
|
94
|
+
grep -r "https://.*\.salesforce\.com" force-app/main/default/
|
|
95
|
+
grep -r "[a-zA-Z0-9]{15,18}" force-app/main/default/ | grep -v "meta.xml"
|
|
96
|
+
|
|
97
|
+
# Validate Custom Settings and Custom Metadata
|
|
98
|
+
sf project retrieve start --metadata CustomObject:*__c
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
**Configuration checklist**:
|
|
102
|
+
- [ ] No hardcoded production URLs in code
|
|
103
|
+
- [ ] No hardcoded record IDs
|
|
104
|
+
- [ ] Custom Settings configured correctly for target org
|
|
105
|
+
- [ ] Custom Metadata Types populated appropriately
|
|
106
|
+
- [ ] Email templates reference correct org email
|
|
107
|
+
- [ ] Reports and Dashboards folders have correct permissions
|
|
108
|
+
|
|
109
|
+
## Step 5: Review Dependencies
|
|
110
|
+
|
|
111
|
+
Check for dependency conflicts or missing components:
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
# Generate dependency report
|
|
115
|
+
sf project deploy validate --manifest package.xml --test-level RunLocalTests --verbose
|
|
116
|
+
|
|
117
|
+
# Check for missing dependencies
|
|
118
|
+
grep -i "error.*component" deployment_log.txt
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Common dependency issues:
|
|
122
|
+
- Missing Custom Fields referenced in code
|
|
123
|
+
- Validation Rules referencing deleted fields
|
|
124
|
+
- Workflows or Process Builders using deprecated actions
|
|
125
|
+
- Lightning Components with missing design resources
|
|
126
|
+
|
|
127
|
+
See [dependency troubleshooting guide](references/dependency_resolution.md) for solutions.
|
|
128
|
+
|
|
129
|
+
## Step 6: Generate Deployment Checklist
|
|
130
|
+
|
|
131
|
+
Use the deployment checklist template to document your release:
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
cp assets/deployment_checklist.md deployment_checklist_$(date +%Y%m%d).md
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Fill out the checklist with:
|
|
138
|
+
- [ ] Deployment date and time window
|
|
139
|
+
- [ ] Components being deployed (attach package.xml)
|
|
140
|
+
- [ ] Test execution results and coverage
|
|
141
|
+
- [ ] Backup verification (data and metadata)
|
|
142
|
+
- [ ] Rollback procedure documented
|
|
143
|
+
- [ ] Stakeholders notified
|
|
144
|
+
- [ ] Post-deployment validation steps
|
|
145
|
+
- [ ] Monitoring plan for 24-48 hours
|
|
146
|
+
|
|
147
|
+
## Step 7: Execute Pre-Deployment Validation
|
|
148
|
+
|
|
149
|
+
Run a validation-only deployment to catch issues before actual deployment:
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
# Validate deployment without committing
|
|
153
|
+
sf project deploy validate \
|
|
154
|
+
--manifest package.xml \
|
|
155
|
+
--test-level RunLocalTests \
|
|
156
|
+
--verbose
|
|
157
|
+
|
|
158
|
+
# Save the validation ID for quick deploy
|
|
159
|
+
sf project deploy start --use-most-recent-validation --async
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
**Benefits of validation**:
|
|
163
|
+
- Tests run in production environment
|
|
164
|
+
- Identifies environment-specific issues
|
|
165
|
+
- Generates Quick Deploy ID for faster deployment
|
|
166
|
+
- No changes committed until you confirm
|
|
167
|
+
|
|
168
|
+
Review validation results and address any failures before scheduling deployment.
|
|
169
|
+
|
|
170
|
+
## Step 8: Prepare Rollback Plan
|
|
171
|
+
|
|
172
|
+
Document rollback procedures before deploying:
|
|
173
|
+
|
|
174
|
+
1. **Backup current state**
|
|
175
|
+
```bash
|
|
176
|
+
sf project retrieve start --manifest package.xml --target-org production
|
|
177
|
+
git tag pre-deployment-$(date +%Y%m%d) && git push --tags
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
2. **Test rollback procedure** in sandbox:
|
|
181
|
+
- Deploy previous version of metadata
|
|
182
|
+
- Verify functionality is restored
|
|
183
|
+
- Document any data cleanup required
|
|
184
|
+
|
|
185
|
+
3. **Establish rollback criteria**:
|
|
186
|
+
- Critical bugs found within 2 hours
|
|
187
|
+
- Core functionality broken
|
|
188
|
+
- Performance degradation >50%
|
|
189
|
+
- Data integrity issues
|
|
190
|
+
|
|
191
|
+
See [rollback procedures reference](references/rollback_procedures.md) for detailed steps.
|
|
192
|
+
|
|
193
|
+
## Post-Deployment Validation
|
|
194
|
+
|
|
195
|
+
After successful deployment, verify the release:
|
|
196
|
+
|
|
197
|
+
1. **Smoke tests** - Execute critical user workflows
|
|
198
|
+
2. **Monitor logs** - Check debug logs for errors (24-48 hours)
|
|
199
|
+
3. **Query test data** - Verify triggers and automation work correctly
|
|
200
|
+
4. **User acceptance** - Confirm with stakeholders functionality works
|
|
201
|
+
5. **Performance check** - Review governor limit usage in logs
|
|
202
|
+
|
|
203
|
+
## Common Issues and Solutions
|
|
204
|
+
|
|
205
|
+
### Issue: Test Coverage Drops Below 75%
|
|
206
|
+
|
|
207
|
+
**Cause**: New Apex classes added without sufficient tests.
|
|
208
|
+
|
|
209
|
+
**Solution**:
|
|
210
|
+
1. Run `sf apex test run --code-coverage` to identify gaps
|
|
211
|
+
2. Add test methods covering uncovered lines
|
|
212
|
+
3. Revalidate coverage
|
|
213
|
+
|
|
214
|
+
### Issue: Validation Fails with "Component Not Found"
|
|
215
|
+
|
|
216
|
+
**Cause**: Missing dependency in package.xml.
|
|
217
|
+
|
|
218
|
+
**Solution**:
|
|
219
|
+
1. Review error message for missing component
|
|
220
|
+
2. Add component to package.xml
|
|
221
|
+
3. Retrieve component from source org if needed
|
|
222
|
+
4. Revalidate
|
|
223
|
+
|
|
224
|
+
### Issue: Permission Errors After Deployment
|
|
225
|
+
|
|
226
|
+
**Cause**: FLS or object permissions not deployed correctly.
|
|
227
|
+
|
|
228
|
+
**Solution**:
|
|
229
|
+
1. Verify profiles/permission sets are in package.xml
|
|
230
|
+
2. Check that CustomObject metadata includes field permissions
|
|
231
|
+
3. Deploy profiles separately if needed
|
|
232
|
+
4. Use Permission Set Groups for complex permission hierarchies
|
|
233
|
+
|
|
234
|
+
## Best Practices
|
|
235
|
+
|
|
236
|
+
1. **Always validate before deploying** - Never deploy directly to production without validation
|
|
237
|
+
2. **Run full test suite** - Use RunLocalTests, not NoTestRun
|
|
238
|
+
3. **Deploy during maintenance windows** - Minimize impact on users
|
|
239
|
+
4. **Communicate with stakeholders** - Notify before, during, and after deployment
|
|
240
|
+
5. **Monitor post-deployment** - Watch logs and user feedback for 24-48 hours
|
|
241
|
+
6. **Document everything** - Maintain deployment logs and decisions
|
|
242
|
+
7. **Use version control tags** - Tag releases for easy rollback
|
|
243
|
+
|
|
244
|
+
## References
|
|
245
|
+
|
|
246
|
+
- [Security Checklist](references/security_checklist.md) - Detailed security review steps
|
|
247
|
+
- [Dependency Resolution Guide](references/dependency_resolution.md) - Solve dependency conflicts
|
|
248
|
+
- [Rollback Procedures](references/rollback_procedures.md) - Step-by-step rollback guide
|
|
249
|
+
- [Deployment Checklist Template](assets/deployment_checklist.md) - Reusable checklist
|
|
250
|
+
|
|
251
|
+
## Automation Opportunities
|
|
252
|
+
|
|
253
|
+
Consider automating this skill:
|
|
254
|
+
- **CI/CD Integration** - Run validation script in pipeline
|
|
255
|
+
- **Scheduled Coverage Checks** - Monitor test coverage daily
|
|
256
|
+
- **Auto-generated Documentation** - Create deployment notes from package.xml
|
|
257
|
+
- **Slack/Email Notifications** - Alert team of deployment status
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
# Salesforce Deployment Checklist
|
|
2
|
+
|
|
3
|
+
**Deployment Date**: _________________
|
|
4
|
+
**Deployment Time Window**: _________ to _________
|
|
5
|
+
**Environment**: ☐ Production ☐ Sandbox ☐ UAT
|
|
6
|
+
**Deployment Lead**: _________________
|
|
7
|
+
**Release Version**: _________________
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Pre-Deployment
|
|
12
|
+
|
|
13
|
+
### 1. Code & Configuration Review
|
|
14
|
+
|
|
15
|
+
- [ ] All code reviewed and approved via pull request
|
|
16
|
+
- [ ] Code follows organizational coding standards
|
|
17
|
+
- [ ] No debugging statements or console.logs in production code
|
|
18
|
+
- [ ] API versions are current (API 56.0+)
|
|
19
|
+
- [ ] Hard-coded IDs/URLs removed (use Custom Settings or Custom Metadata)
|
|
20
|
+
- [ ] Comments and documentation are up-to-date
|
|
21
|
+
|
|
22
|
+
### 2. Testing
|
|
23
|
+
|
|
24
|
+
- [ ] All unit tests pass locally
|
|
25
|
+
- [ ] Test coverage meets minimum requirements (≥75% org-wide)
|
|
26
|
+
- [ ] Integration tests executed successfully
|
|
27
|
+
- [ ] User acceptance testing (UAT) completed
|
|
28
|
+
- [ ] Regression testing performed for existing features
|
|
29
|
+
- [ ] Performance testing validates no degradation
|
|
30
|
+
|
|
31
|
+
**Test Results**:
|
|
32
|
+
- Total classes: _____
|
|
33
|
+
- Test coverage: _____%
|
|
34
|
+
- Failed tests: _____
|
|
35
|
+
- Test run ID: _________________
|
|
36
|
+
|
|
37
|
+
### 3. Security Review
|
|
38
|
+
|
|
39
|
+
- [ ] Profile/permission set changes reviewed
|
|
40
|
+
- [ ] Field-level security validated
|
|
41
|
+
- [ ] Sharing rules appropriate for data sensitivity
|
|
42
|
+
- [ ] No admin permissions granted to standard users
|
|
43
|
+
- [ ] Connected Apps use appropriate OAuth scopes
|
|
44
|
+
- [ ] Named Credentials use secure authentication
|
|
45
|
+
- [ ] Sensitive data is encrypted or masked
|
|
46
|
+
|
|
47
|
+
### 4. Dependencies
|
|
48
|
+
|
|
49
|
+
- [ ] All metadata dependencies identified
|
|
50
|
+
- [ ] Missing components added to package.xml
|
|
51
|
+
- [ ] External system dependencies documented
|
|
52
|
+
- [ ] API integrations tested in target environment
|
|
53
|
+
- [ ] Third-party packages compatible with deployment
|
|
54
|
+
|
|
55
|
+
### 5. Backup & Rollback
|
|
56
|
+
|
|
57
|
+
- [ ] Pre-deployment backup completed
|
|
58
|
+
- Metadata backup: ☐ Yes ☐ N/A
|
|
59
|
+
- Data backup: ☐ Yes ☐ N/A
|
|
60
|
+
- Backup location: _________________
|
|
61
|
+
- [ ] Rollback procedure documented and tested
|
|
62
|
+
- [ ] Rollback criteria defined
|
|
63
|
+
- [ ] Emergency contacts list current
|
|
64
|
+
|
|
65
|
+
### 6. Documentation
|
|
66
|
+
|
|
67
|
+
- [ ] Release notes prepared
|
|
68
|
+
- [ ] Deployment guide created
|
|
69
|
+
- [ ] User training materials ready (if applicable)
|
|
70
|
+
- [ ] Help documentation updated
|
|
71
|
+
- [ ] Known issues documented
|
|
72
|
+
- [ ] FAQ prepared for support team
|
|
73
|
+
|
|
74
|
+
### 7. Communication
|
|
75
|
+
|
|
76
|
+
- [ ] Stakeholders notified of deployment schedule
|
|
77
|
+
- [ ] Users notified of system downtime (if applicable)
|
|
78
|
+
- [ ] Support team briefed on changes
|
|
79
|
+
- [ ] Change advisory board approval obtained
|
|
80
|
+
- [ ] Post-deployment communication template ready
|
|
81
|
+
|
|
82
|
+
### 8. Validation
|
|
83
|
+
|
|
84
|
+
- [ ] Validation deployment successful in production
|
|
85
|
+
- [ ] Quick Deploy ID obtained: _________________
|
|
86
|
+
- [ ] Validation results reviewed and approved
|
|
87
|
+
- [ ] All deployment warnings addressed
|
|
88
|
+
|
|
89
|
+
**Validation Command**:
|
|
90
|
+
```bash
|
|
91
|
+
sf project deploy validate --manifest package.xml --test-level RunLocalTests --verbose
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## Deployment Execution
|
|
97
|
+
|
|
98
|
+
### 9. Pre-Deployment Actions
|
|
99
|
+
|
|
100
|
+
- [ ] Announced maintenance window to users
|
|
101
|
+
- [ ] Disabled scheduled jobs/batch processes (if required)
|
|
102
|
+
- Jobs disabled: _________________
|
|
103
|
+
- [ ] Created deployment tag in git: _________________
|
|
104
|
+
- [ ] Verified target org connectivity
|
|
105
|
+
- [ ] Team on standby for deployment
|
|
106
|
+
|
|
107
|
+
### 10. Deployment
|
|
108
|
+
|
|
109
|
+
**Deployment Start Time**: _________
|
|
110
|
+
|
|
111
|
+
- [ ] Deployment initiated via validated package or change set
|
|
112
|
+
- [ ] Deployment progress monitored
|
|
113
|
+
- [ ] Test execution in progress
|
|
114
|
+
- [ ] Any deployment errors addressed immediately
|
|
115
|
+
|
|
116
|
+
**Deployment Command**:
|
|
117
|
+
```bash
|
|
118
|
+
sf project deploy start --use-most-recent-validation
|
|
119
|
+
# OR
|
|
120
|
+
sf project deploy start --manifest package.xml --test-level RunLocalTests
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
**Deployment ID**: _________________
|
|
124
|
+
|
|
125
|
+
**Deployment End Time**: _________
|
|
126
|
+
|
|
127
|
+
**Duration**: _________ minutes
|
|
128
|
+
|
|
129
|
+
### 11. Post-Deployment Verification
|
|
130
|
+
|
|
131
|
+
- [ ] Deployment completed successfully
|
|
132
|
+
- [ ] All tests passed in production
|
|
133
|
+
- [ ] Deployment results reviewed (no warnings/errors)
|
|
134
|
+
- [ ] Smoke tests executed successfully
|
|
135
|
+
- [ ] Critical user workflows verified:
|
|
136
|
+
- [ ] Workflow 1: _________________
|
|
137
|
+
- [ ] Workflow 2: _________________
|
|
138
|
+
- [ ] Workflow 3: _________________
|
|
139
|
+
- [ ] Re-enabled scheduled jobs/batch processes
|
|
140
|
+
- [ ] Debug logs show no new errors
|
|
141
|
+
|
|
142
|
+
### 12. Post-Deployment Actions
|
|
143
|
+
|
|
144
|
+
- [ ] Stakeholders notified of successful deployment
|
|
145
|
+
- [ ] Users notified system is available
|
|
146
|
+
- [ ] Release notes published
|
|
147
|
+
- [ ] Support team provided with deployment summary
|
|
148
|
+
- [ ] Monitoring dashboard reviewed
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## Post-Deployment Monitoring (24-48 Hours)
|
|
153
|
+
|
|
154
|
+
### 13. System Monitoring
|
|
155
|
+
|
|
156
|
+
- [ ] **Day 1** - Monitor debug logs for errors
|
|
157
|
+
- Errors found: ☐ Yes ☐ No
|
|
158
|
+
- If yes, describe: _________________
|
|
159
|
+
- [ ] **Day 1** - Review governor limit usage
|
|
160
|
+
- Limits exceeded: ☐ Yes ☐ No
|
|
161
|
+
- [ ] **Day 1** - Check user-reported issues
|
|
162
|
+
- Issues reported: ☐ Yes ☐ No
|
|
163
|
+
- [ ] **Day 2** - Confirm automation working correctly
|
|
164
|
+
- [ ] **Day 2** - Validate data integrity
|
|
165
|
+
- [ ] **Day 2** - Review performance metrics
|
|
166
|
+
|
|
167
|
+
### 14. User Acceptance
|
|
168
|
+
|
|
169
|
+
- [ ] Key users confirmed functionality works
|
|
170
|
+
- [ ] No critical bugs reported
|
|
171
|
+
- [ ] User feedback collected
|
|
172
|
+
- [ ] Support tickets categorized by severity
|
|
173
|
+
|
|
174
|
+
**Feedback Summary**:
|
|
175
|
+
_________________
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
## Rollback (If Required)
|
|
180
|
+
|
|
181
|
+
**Rollback Decision**: ☐ Yes ☐ No
|
|
182
|
+
|
|
183
|
+
**Reason**: _________________
|
|
184
|
+
|
|
185
|
+
- [ ] Stakeholder approval for rollback obtained
|
|
186
|
+
- [ ] Users notified of rollback
|
|
187
|
+
- [ ] Rollback procedure executed
|
|
188
|
+
- [ ] Rollback verified successful
|
|
189
|
+
- [ ] Post-rollback communication sent
|
|
190
|
+
|
|
191
|
+
**Rollback Time**: _________
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
## Deployment Summary
|
|
196
|
+
|
|
197
|
+
### Components Deployed
|
|
198
|
+
|
|
199
|
+
| Component Type | Count | Examples |
|
|
200
|
+
|----------------|-------|----------|
|
|
201
|
+
| Apex Classes | | |
|
|
202
|
+
| Apex Triggers | | |
|
|
203
|
+
| LWC | | |
|
|
204
|
+
| Flows | | |
|
|
205
|
+
| Custom Objects | | |
|
|
206
|
+
| Custom Fields | | |
|
|
207
|
+
| Profiles | | |
|
|
208
|
+
| Perm Sets | | |
|
|
209
|
+
| Other | | |
|
|
210
|
+
|
|
211
|
+
**Total Components**: _____
|
|
212
|
+
|
|
213
|
+
### Deployment Metrics
|
|
214
|
+
|
|
215
|
+
- Validation time: _________ minutes
|
|
216
|
+
- Deployment time: _________ minutes
|
|
217
|
+
- Test execution time: _________ minutes
|
|
218
|
+
- Total elapsed time: _________ minutes
|
|
219
|
+
- Downtime (if any): _________ minutes
|
|
220
|
+
|
|
221
|
+
### Issues Encountered
|
|
222
|
+
|
|
223
|
+
| Issue | Severity | Resolution | Time to Resolve |
|
|
224
|
+
|-------|----------|------------|-----------------|
|
|
225
|
+
| | | | |
|
|
226
|
+
| | | | |
|
|
227
|
+
|
|
228
|
+
**Total Issues**: _____
|
|
229
|
+
|
|
230
|
+
---
|
|
231
|
+
|
|
232
|
+
## Sign-Off
|
|
233
|
+
|
|
234
|
+
### Deployment Team
|
|
235
|
+
|
|
236
|
+
**Deployment Lead**: _________________ Date: _________
|
|
237
|
+
**Developer(s)**: _________________ Date: _________
|
|
238
|
+
**QA Lead**: _________________ Date: _________
|
|
239
|
+
**DevOps Engineer**: _________________ Date: _________
|
|
240
|
+
|
|
241
|
+
### Stakeholders
|
|
242
|
+
|
|
243
|
+
**Product Owner**: _________________ Date: _________
|
|
244
|
+
**Business Analyst**: _________________ Date: _________
|
|
245
|
+
**Release Manager**: _________________ Date: _________
|
|
246
|
+
|
|
247
|
+
---
|
|
248
|
+
|
|
249
|
+
## Post-Deployment Review
|
|
250
|
+
|
|
251
|
+
**Review Date**: _________________
|
|
252
|
+
|
|
253
|
+
### What Went Well
|
|
254
|
+
1. _________________
|
|
255
|
+
2. _________________
|
|
256
|
+
3. _________________
|
|
257
|
+
|
|
258
|
+
### What Could Be Improved
|
|
259
|
+
1. _________________
|
|
260
|
+
2. _________________
|
|
261
|
+
3. _________________
|
|
262
|
+
|
|
263
|
+
### Action Items
|
|
264
|
+
- [ ] Action: _________________ Owner: _________ Due: _________
|
|
265
|
+
- [ ] Action: _________________ Owner: _________ Due: _________
|
|
266
|
+
- [ ] Action: _________________ Owner: _________ Due: _________
|
|
267
|
+
|
|
268
|
+
---
|
|
269
|
+
|
|
270
|
+
## Attachments
|
|
271
|
+
|
|
272
|
+
- [ ] package.xml
|
|
273
|
+
- [ ] Test results report
|
|
274
|
+
- [ ] Deployment log
|
|
275
|
+
- [ ] Release notes
|
|
276
|
+
- [ ] Rollback procedure (if executed)
|
|
277
|
+
- [ ] Post-deployment monitoring reports
|
|
278
|
+
|
|
279
|
+
**Storage Location**: _________________
|
|
280
|
+
|
|
281
|
+
---
|
|
282
|
+
|
|
283
|
+
**Notes**:
|
|
284
|
+
_________________
|
|
285
|
+
_________________
|
|
286
|
+
_________________
|