docs: add change-set checklist, production deployment guide, and previous design archive

This commit is contained in:
Paul Huliganga 2026-04-03 11:46:32 -04:00
parent 1286925765
commit d70cd8a97a
3 changed files with 315 additions and 0 deletions

View File

@ -0,0 +1,26 @@
Change Set Checklist — Docusign Composite Envelope Builder
Add these components to your Outbound Change Set in the Sandbox:
- Flow
- Flow (component type: `Flow` / `Flow Definition`)
- `DocuSign_Envelope_Templates` (use the V4 Flow version)
- Apex Classes (component type: `Apex Class`)
- DocusignCompositeEnvelopeBuilder
- DocusignEnvelopeRequest
- DocusignEnvelopeRequestHandler
- DocusignEnvelopeResult
- DocusignCompositeEnvelopeBuilderTest (test class)
- DocusignEnvelopeRequestHandlerTest (test class)
- Apex Triggers: None (this package does not include any triggers)
- Custom Objects / Fields: None required
- Note: The repository contains a leftover `Docusign_Configuration__c` object with `Account_Id__c` and `Base_URL__c`, but the current implementation uses the `dfsle` managed-package objects (`dfsle__EnvelopeConfiguration__c`) and does not reference `Docusign_Configuration__c`. Do not include `Docusign_Configuration__c` unless you explicitly want to preserve it.
Post-deploy checklist in Production:
- Assign permission sets (if any) to users.
- Test Flow run via the relevant record page.
- Run Apex test classes and verify overall code coverage.
- Verify dfsle templates are present in Production (managed-package data/configuration).

View File

@ -0,0 +1,88 @@
# Deploying Flow and APEX Code to Salesforce Production
This guide provides step-by-step instructions for moving your Flow and APEX code from a sandbox to a Salesforce production organization **using Salesforce's built-in tools** (no local source code required).
## Prerequisites
- You have access to both the sandbox and production Salesforce orgs.
- You have System Administrator permissions in both orgs.
- The Flow and APEX code are already deployed and tested in the sandbox.
---
## 1. Use Change Sets to Deploy Metadata
### A. Create an Outbound Change Set in Sandbox
1. **Login to your Sandbox**.
2. Go to **Setup** > **Change Sets** > **Outbound Change Sets**.
3. Click **New** to create a new change set (e.g., "Docusign Composite Envelope Builder").
4. Add a description for clarity.
5. Click **Save**.
### B. Add Components to the Change Set
1. In the change set, click **Add** under "Change Set Components".
2. **Add the Flow(s):**
- Component Type: `Flow Definition` or `Flow`.
- Select the active Flow version for the application. For this repository the Flow to include is `Docusign_Envelope_Templates_V4`.
3. **Add APEX Classes:**
- Component Type: `Apex Class`.
- Include the following Apex classes from the package:
- `DocusignCompositeEnvelopeBuilder`
- `DocusignEnvelopeRequest`
- `DocusignEnvelopeRequestHandler`
- `DocusignEnvelopeResult`
- Also include associated test classes:
- `DocusignCompositeEnvelopeBuilderTest`
- `DocusignEnvelopeRequestHandlerTest`
4. **Apex Triggers:**
- This package does not include any Apex Triggers. There are no trigger files in `force-app/main/default/triggers` to add to the change set.
5. **Custom Objects / Fields:**
- There are no custom objects or custom fields that must be deployed for the current implementation. The repository does contain a `Docusign_Configuration__c` object (with `Account_Id__c` and `Base_URL__c`) in `force-app/main/default/objects`, but it is not referenced by the APEX classes or the Flow (the implementation uses the `dfsle` toolkit and `dfsle__EnvelopeConfiguration__c` templates). You do not need to include `Docusign_Configuration__c` or its fields in the change set unless you intentionally want to preserve that leftover metadata.
6. Click **Add to Change Set** after each selection.
### C. Add Profiles/Permission Sets (Optional)
- If your app uses custom permissions, add the relevant profiles or permission sets.
### D. Upload the Change Set to Production
1. In the change set, click **Upload**.
2. Select your production org as the target.
3. Click **Upload**.
---
## 2. Deploy the Change Set in Production
### A. Login to Production
1. **Login to your Production Salesforce org**.
2. Go to **Setup** > **Change Sets** > **Inbound Change Sets**.
### B. Validate and Deploy
1. Find the uploaded change set.
2. Click the change set name to review components.
3. Click **Validate** to run tests and check for errors.
4. If validation passes, click **Deploy**.
5. Monitor deployment status and resolve any errors if needed.
---
## 3. Post-Deployment Steps
- **Assign Permission Sets/Profiles** to users as needed.
- **Test the Flow and APEX functionality** in production.
- **Review Custom Settings/Metadata** for environment-specific values (e.g., API keys, URLs).
---
## Troubleshooting
- If deployment fails, review error messages for missing dependencies or test failures.
- Ensure all referenced components (objects, fields, flows, classes) are included in the change set.
- For large or complex deployments, consider deploying in smaller batches.
---
## References
- [Salesforce Change Sets Documentation](https://help.salesforce.com/s/articleView?id=sf.changesets.htm)
- [Deploy Flows with Change Sets](https://help.salesforce.com/s/articleView?id=sf.flow_deploy.htm)
- [Deploy Apex Code with Change Sets](https://help.salesforce.com/s/articleView?id=sf.code_deploy_changeset.htm)
---
**Contact your Salesforce administrator or partner for additional support if needed.**

View File

@ -0,0 +1,201 @@
# Design Document (previous)
**Project**: Salesforce Composite Envelope Builder
**Version**: 1.2
**Date**: February 23, 2026 (updated March 15, 2026)
**Author**: Paul Huliganga
---
## 1. Architecture Overview
### 1.1 System Context
```
┌──────────────────┐
│ Salesforce User │
└────────┬─────────┘
┌─────────────────────────────────────────┐
│ Salesforce Platform │
│ ┌──────────────┐ ┌───────────────┐ │
│ │ Screen Flow │───▶│ Apex Class │ │
│ │ (Template │ │ (Composite │ │
│ │ Selection) │ │ Builder) │ │
│ └──────────────┘ └───────┬───────┘ │
│ │ │
└──────────────────────────────┼───────────┘
▼ HTTPS/REST API
┌──────────────────────┐
│ Docusign REST API │
│ (Composite │
│ Templates) │
└──────────────────────┘
```
### 1.2 Component Architecture
```
┌────────────────────────────────────────────────────────┐
│ Salesforce Org │
│ │
│ ┌─────────────────────────────────────────────────┐ │
│ │ Presentation Layer (Screen Flow) │ │
│ │ - Language selection │ │
│ │ - Template display (checkbox collection) │ │
│ │ - Success/error messaging │ │
│ └──────────────────┬──────────────────────────────┘ │
│ │ │
│ ┌─────────────────▼──────────────────────────────┐ │
│ │ Business Logic Layer (Apex) │ │
│ │ │ │
│ │ ┌─────────────────────────────────────────┐ │ │
│ │ │ DocusignCompositeEnvelopeBuilder │ │ │
│ │ │ - @InvocableMethod entry point │ │ │
│ │ │ - Input validation │ │ │
│ │ │ - Multi-copy template expansion │ │ │
│ │ │ - SMS delivery (withSmsDelivery) │ │ │
│ │ │ - Composite JSON construction │ │ │
│ │ │ - Envelope ID return │ │ │
│ │ └──────────────────┬──────────────────────┘ │ │
│ │ │ │ │
│ │ ┌─────────────────▼──────────────────────┐ │ │
│ │ │ DocusignAPIService │ │ │
│ │ │ - API authentication │ │ │
│ │ │ - HTTP callout construction │ │ │
│ │ │ - Response parsing │ │ │
│ │ │ - Error handling │ │ │
│ │ └──────────────────┬──────────────────────┘ │ │
│ │ │ │ │
│ │ ┌─────────────────▼──────────────────────┐ │ │
│ │ │ DocusignCredentials │ │ │
│ │ │ - Credential retrieval │ │ │
│ │ │ - Token management │ │ │
│ │ └─────────────────────────────────────────┘ │ │
│ └──────────────────────────────────────────────┘ │
│ │
│ ┌──────────────────────────────────────────────┐ │
│ │ Data Layer │ │
│ │ - Named Credential (Docusign API creds) │ │
│ │ - Custom Settings (configuration) │ │
│ └──────────────────────────────────────────────┘ │
└───────────────────────────────────────────────────────┘
▼ HTTPS REST API
┌──────────────────────┐
│ Docusign Platform │
└──────────────────────┘
```
---
## 2. Detailed Component Design
### 2.1 DocusignCompositeEnvelopeBuilder (Main Class)
**Purpose**: Invocable Apex class that combines multiple Docusign templates into a single envelope
**Responsibilities**:
- Receive template IDs from Screen Flow
- Validate inputs
- Expand multi-copy templates (e.g. Authorization to Release Information)
- Construct composite template JSON
- Delegate API call to service class
- Return envelope ID to Flow
**Methods**:
```apex
// Flow-invocable entry point
@InvocableMethod(
label='Send Composite Docusign Envelope'
description='Combines multiple templates into one envelope'
)
public static List<Result> sendCompositeEnvelope(List<Request> requests)
// Private helper methods
private static String buildCompositeEnvelopeJSON(
List<String> templateIds,
String recordId,
String language,
Map<String, String> customFields
)
private static void validateInputs(Request req)
private static List<String> sortTemplatesAlphabetically(List<String> templateIds)
```
**Inner Classes**:
```apex
public class Request {
@InvocableVariable(required=true label='Template IDs')
public List<String> templateIds;
@InvocableVariable(required=true label='Salesforce Record ID')
public String recordId;
@InvocableVariable(required=false label='Language')
public String language; // 'en' or 'es'
@InvocableVariable(required=false label='Email Subject')
public String emailSubject;
@InvocableVariable(required=false label='Authorization to Release Form Copies')
public Integer authReleaseFormCopies; // 15; only used when that template is selected
@InvocableVariable(required=false label='Recipient SMS Phone')
public String recipientSmsPhone; // E.164 preferred (+15551234567); triggers SMS delivery for Docusign Recipient #1
@InvocableVariable(required=false label='Custom Fields')
public Map<String, String> customFields; // For merge fields
}
public class Result {
@InvocableVariable(label='Envelope ID')
public String envelopeId;
@InvocableVariable(label='Success')
public Boolean success;
@InvocableVariable(label='Error Message')
public String errorMessage;
}
```
---
### 2.2 DocusignAPIService (Service Class)
**Purpose**: Handles all Docusign REST API interactions
**Responsibilities**:
- Construct HTTP requests
- Make callouts to Docusign API
- Parse responses
- Handle errors and retries
- Log API interactions
**Methods**:
```apex
public static String createCompositeEnvelope(
String envelopeJSON,
DocusignCredentials creds
)
public static HttpResponse callDocusignAPI(
String endpoint,
String method,
String body,
Map<String, String> headers
)
public static String parseEnvelopeId(HttpResponse response)
private static void logAPICall(
HttpRequest req,
```