Commit Graph

11 Commits

Author SHA1 Message Date
Paul Huliganga 4211648e2a feat: add recipient resolution from Client_Case__c lookup fields
- Queries Client_Case__c for Service_Coordinator__c and Docusign_Recipient_1__c
- Resolves Contact/User name and email from lookup targets
- Maps recipients to Docusign template roles: 'Service Coordinator' and 'Docusign Recipient #1'
- Validates recipients exist and have email addresses
- Supports both Contact and User lookup types
- Role names and field names are configurable constants at top of class
- Clear error messages if recipients are missing or have no email
2026-02-25 12:28:08 -05:00
Paul Huliganga 4b1edd4d27 refactor: switch to dfsle Apex Toolkit - remove raw API code
BREAKING CHANGE: Now uses dfsle managed package for Docusign integration.
No separate credentials or Named Credentials needed.

Changes:
- Rewrote DocusignCompositeEnvelopeBuilder to use dfsle.EnvelopeService
  and dfsle.Document.fromTemplate() for composite envelopes
- Simplified DocusignEnvelopeRequestHandler to validation-only
- Updated all tests to use dfsle.TestUtils.setMock()
- 12 comprehensive test methods (success, validation, edge cases)

Deleted (no longer needed):
- DocusignAPIService.cls (raw HTTP callouts)
- DocusignAPIServiceTest.cls
- DocusignCredentials.cls (custom settings)
- DocusignCredentialsTest.cls

Benefits:
- Uses existing dfsle package authentication automatically
- No Named Credential or Custom Setting setup required
- ~95 lines of code vs ~380 lines before
- Fully supported by Docusign managed package
2026-02-25 11:29:38 -05:00
Paul Huliganga ace2518349 fix: reorder V3 Flow XML elements - group same types together
Salesforce requires elements of the same type (recordLookups, decisions,
screens, etc.) to be grouped together. Reordered all elements alphabetically
by type to comply with Flow metadata schema.
2026-02-25 11:06:40 -05:00
Paul Huliganga 19852fd4bb fix: move flow XML files to correct force-app/main/default/flows/ directory 2026-02-25 11:03:10 -05:00
Paul Huliganga f56b5374e4 feat: add V3 Flow XML for composite envelope sending
V3 replaces individual envelope sends with single composite API call:
- Added dfsle__DocuSignId__c to record lookup query
- New loop builds text collection of Docusign template IDs from selected rows
- Single Action call to DocusignCompositeEnvelopeBuilder after loop
- Passes language from Client_Case__c automatically
- New success screen shows envelope ID
- New error screen with error message display
- Result checking decision (success/failure routing)
- Flow status: Draft (safe to deploy and test)
2026-02-25 10:52:48 -05:00
Paul Huliganga 7df62e06ca refactor: extract Request and Result as standalone global classes
- Created DocusignEnvelopeRequest.cls (separate global class for input)
- Created DocusignEnvelopeResult.cls (separate global class for output)
- Updated DocusignCompositeEnvelopeBuilder to use standalone classes
- Updated DocusignEnvelopeRequestHandler to reference standalone classes
- Updated all test classes to use new class references
- Fixes Flow Builder visibility issues with nested inner classes
- Better API design with clear input/output types
- Easier to extend and reuse across other classes
2026-02-25 10:05:36 -05:00
Paul Huliganga 565b851462 docs: add section for running tests for individual classes only
- Added examples for each test class: DocusignCompositeEnvelopeBuilderTest, DocusignEnvelopeRequestHandlerTest, DocusignAPIServiceTest, DocusignCredentialsTest
- Included both Bash/WSL and PowerShell versions
- Useful for targeted testing during development
- Includes --code-coverage flag for coverage metrics
2026-02-25 09:42:39 -05:00
Paul Huliganga b00a930e8d fix: remove duplicate JSON builder test from main class
- Removed testJSONBuilder from DocusignCompositeEnvelopeBuilderTest
- JSON building logic tests now handled by DocusignEnvelopeRequestHandlerTest (10 comprehensive tests)
- Fixes deployment error: method buildCompositeEnvelopeJSON no longer exists in main class
- Eliminates code duplication between test classes
2026-02-25 09:39:18 -05:00
Paul Huliganga 1ff6bb7d76 docs: add PowerShell commands alongside Bash for Windows Terminal users
- Added PowerShell equivalents for all CLI commands
- Updated directory navigation for Windows paths
- Added note explaining shell differences
- Covers: deploy, test, authorization, troubleshooting
- Uses env:USERPROFILE for Windows home directory
- Shows both backtick continuation and semicolon alternatives for PowerShell
2026-02-25 09:35:51 -05:00
Paul Huliganga 2f7dcf3520 refactor: extract request handling to global DocusignEnvelopeRequestHandler class + deployment guide
Changes:
- Move validation logic to DocusignEnvelopeRequestHandler.validateRequest()
- Move envelope JSON building to DocusignEnvelopeRequestHandler.buildEnvelopeJSON()
- Add comprehensive test suite for handler (10 test methods)
- Simplify main invocable method - focus on orchestration
- Add DEPLOYMENT_AND_TESTING.md reference guide with all CLI commands
- Handler is reusable for future enhancements and integrations

Benefits:
- Single Responsibility Principle
- Reusable handler for other classes
- Better testability
- Clean separation of concerns
2026-02-25 09:32:55 -05:00
Paul Huliganga 4f734f0d17 Initial commit: Salesforce Composite Envelope Builder 2026-02-25 09:22:29 -05:00