6.4 KiB
Quick Start Guide
✅ Phase 2 Complete: Code Development
All Apex classes and tests have been created! Here's what you have:
📦 Code Files Created (6 classes)
Main Classes:
DocusignCompositeEnvelopeBuilder.cls(11.5 KB) - Invocable method for Flow integrationDocusignAPIService.cls(10.5 KB) - REST API service layerDocusignCredentials.cls(5.9 KB) - Credential management
Test Classes:
4. DocusignCompositeEnvelopeBuilderTest.cls (13.8 KB) - 12 test methods
5. DocusignAPIServiceTest.cls (11.7 KB) - 14 test methods
6. DocusignCredentialsTest.cls (8.0 KB) - 13 test methods
Total: 39 test methods for comprehensive coverage!
Metadata:
- Custom Setting:
Docusign_Configuration__cwithAccount_Id__candBase_URL__cfields - All
.cls-meta.xmlfiles (API version 61.0)
🚀 Next Steps (Deployment)
Step 1: Open Project in VS Code
cd ~/.openclaw/workspace/projects/salesforce-composite-envelope-builder/composite-envelope-builder
code .
Step 2: Install Salesforce Extension Pack (if not already installed)
In VS Code:
- Open Extensions (Ctrl+Shift+X)
- Search for "Salesforce Extension Pack"
- Click Install
Step 3: Authorize Your Salesforce Org
For Sandbox:
sf org login web --alias my-sandbox --instance-url https://test.salesforce.com
For Production:
sf org login web --alias my-production --instance-url https://login.salesforce.com
This will open a browser window. Log in with your Salesforce credentials.
Step 4: Set Default Org
sf config set target-org my-sandbox
Step 5: Deploy to Sandbox
sf project deploy start --target-org my-sandbox
Expected output:
Deploying v61.0 metadata to my-sandbox
Status: Succeeded
Component Deployed:
ApexClass DocusignCompositeEnvelopeBuilder
ApexClass DocusignAPIService
ApexClass DocusignCredentials
ApexClass DocusignCompositeEnvelopeBuilderTest
ApexClass DocusignAPIServiceTest
ApexClass DocusignCredentialsTest
CustomObject Docusign_Configuration__c
Step 6: Run Unit Tests
sf apex run test --wait 10 --result-format human --code-coverage --target-org my-sandbox
Expected output:
=== Test Summary ===
Outcome: Passed
Tests Ran: 39
Passing: 39
Failing: 0
Skipped: 0
Pass Rate: 100%
Code Coverage: 85%+
Step 7: Configure Docusign Credentials
-
Create Named Credential (see docs/deployment-guide.md section 3.1)
- Setup → Named Credentials → New Named Credential
- Name:
DocusignAPI - URL:
https://na3.docusign.net/restapi/v2.1(or your data center)
-
Configure Custom Settings
- Setup → Custom Settings → Docusign Configuration → Manage
- Click "New" (organization-wide default)
- Account Id:
{Your Docusign Account GUID} - Base URL:
callout:DocusignAPI - Save
-
Add Remote Site Settings
- Setup → Remote Site Settings → New Remote Site
- Name:
Docusign_API - URL:
https://na3.docusign.net - Active: ✓
Step 8: Update Screen Flow
See docs/deployment-guide.md section 5 for detailed Flow configuration steps.
Summary:
- Open your existing form selection Flow
- Add Apex Action element (after template selection)
- Select action:
Send Composite Docusign Envelope - Map inputs:
templateIds→{!SelectedTemplateIds}(from checkboxes)recordId→{!recordId}language→{!SelectedLanguage}emailSubject→ "Please review and sign these forms"
- Store outputs:
envelopeId→{!EnvelopeId}success→{!Success}errorMessage→{!ErrorMessage}
- Add Decision element for success/error handling
- Save & Activate
Step 9: Test Integration
- Navigate to Salesforce record
- Launch Screen Flow
- Select language: English
- Check 2-3 templates
- Click Send
- Verify:
- Success message shown
- Envelope ID displayed
- Check Docusign: envelope created with multiple documents
- Recipients receive ONE email
📚 Documentation
All docs are in the docs/ folder:
- requirements.md - What we're building and why
- design.md - Architecture, sequence diagrams, data flow
- api-reference.md - Docusign REST API details
- deployment-guide.md - Complete deployment instructions
🧪 Test Coverage Details
DocusignCompositeEnvelopeBuilderTest (12 methods):
- ✅ Success with 3 templates
- ✅ Single template (minimum)
- ✅ 14 templates (maximum)
- ✅ Duplicate template handling
- ✅ Custom fields support
- ✅ Validation: no templates
- ✅ Validation: too many templates (>14)
- ✅ Validation: missing record ID
- ✅ API error 400 (bad request)
- ✅ API error 401 (unauthorized)
- ✅ JSON builder test
DocusignAPIServiceTest (14 methods):
- ✅ Successful envelope creation
- ✅ Parse envelope ID
- ✅ Parse envelope ID missing
- ✅ Handle errors: 400, 401, 403, 404, 429, 500
- ✅ Retry logic (transient failures)
- ✅ Build HTTP request
- ✅ Execute with retry (non-retryable error)
DocusignCredentialsTest (13 methods):
- ✅ Singleton pattern
- ✅ Load from Custom Settings
- ✅ Get access token, account ID, base URL
- ✅ Validate success
- ✅ Validate failures: missing account ID, base URL, token
- ✅ Set test credentials
- ✅ Reset instance
- ✅ Missing Custom Settings error
- ✅ Named Credential format
Total: 39 test methods across 6 classes
🎯 Project Status
| Phase | Status |
|---|---|
| Requirements & Design | ✅ Complete |
| Apex Code Development | ✅ Complete |
| Unit Tests | ✅ Complete (39 tests) |
| Documentation | ✅ Complete (56+ KB) |
| Deployment | ⏳ Ready to deploy |
| Flow Integration | ⏳ Awaiting deployment |
| Production Testing | ⏳ Next |
💡 Tips
Before Deploying:
- Review
docs/deployment-guide.mdsections 2-3 for Docusign setup - Have your Docusign Integration Key ready
- Know your Docusign Account ID
After Deploying:
- Run all tests to verify 100% pass rate
- Check debug logs for any issues
- Test with 1 template first, then multiple
Flow Modification:
- Keep your existing template selection UI
- Replace the loop that sends individual envelopes
- Add the Apex Action in place of the loop
❓ Need Help?
Check the troubleshooting section in docs/deployment-guide.md (section 10) for common issues and solutions.
Project Created: February 23, 2026
Developer: Paul Huliganga
Ready to Deploy: YES! 🚀