Salesforce + DocuSign CLM integration for automated Appraiser Review Letter generation
Go to file
paulh 45814dc2d5 Add CLMAdminService, DocusignESignatureService, and fix code review issues
New classes:
- CLMAdminService: UI-facing orchestration — account/letter settings from
  metadata, document generation, task status polling, file attachment,
  folder browsing; persists all CLM results to Appraiser_Case__c
- DocusignESignatureService: eSignature API browsing (accounts, templates,
  envelopes, login info, user info)
- CLMAdminServiceTest, CLMDocGenCalloutTest, DocusignESignatureServiceTest

Updated classes (AppraiserCasePayloadBuilder, CLMDocGenCallout):
- CLMDocGenCallout: full XML merge callout stack, task status polling,
  document download, recursive document href discovery, account-based
  endpoint building; HTTP_TIMEOUT made public
- AppraiserCasePayloadBuilder: formatMailingAddress made public so
  CLMAdminService can reuse it rather than duplicating the logic

Code review bug fixes:
- Fix null fields emitting literal "null" in generated XML — add safeValue()
  helper; String.valueOf(null) returns "null" so escapeXml's null guard
  never fired
- Fix unguarded inline SOQL in getCaseContext and getDocGenPreview — throws
  QueryException for missing records instead of AuraHandledException; now
  uses list query with isEmpty guard
- Remove duplicate formatAddress in CLMAdminService; delegate to
  AppraiserCasePayloadBuilder.formatMailingAddress
- Replace hardcoded 30000 timeout in performGet with CLMDocGenCallout.HTTP_TIMEOUT
- Remove duplicate JSDoc on getTaskStatus

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-09 20:36:16 -04:00
artifacts/doc_inspect Add Appraiser Review Letter template and XML merge data 2026-04-05 14:22:57 -04:00
docs Create Appraiser Case custom record and DocGen service 2026-04-05 14:31:51 -04:00
force-app/main/default Add CLMAdminService, DocusignESignatureService, and fix code review issues 2026-04-09 20:36:16 -04:00
manifest Add new Salesforce metadata for account-based CLM and eSignature integration 2026-04-09 20:35:59 -04:00
scripts Create Appraiser Case custom record and DocGen service 2026-04-05 14:31:51 -04:00
.gitignore Initial commit: Salesforce Appraiser Review Letter with DocuSign CLM integration 2026-04-03 12:13:59 -04:00
sfdx-project.json Create Appraiser Case custom record and DocGen service 2026-04-05 14:31:51 -04:00

docs/README.md

Appraiser Review Letter Generator (Salesforce + DocuSign CLM)

Welcome!

This project contains documentation and guides for building Appraiser Review Letter templates for use in Salesforce CLM (Contract Lifecycle Management).


Overview

This application automates generation of personalized appraiser review letters within Salesforce, merging Q&A responses and related data into a DocuSign CLM-powered letter. Content and layout adjust dynamically to each review scenario.

Architecture Overview

  • Templates are rendered using dynamic data from Salesforce objects
  • All merge fields and arrays are mapped from Salesforce data model
  • Modular blocks for easy maintenance and expansion

Key Features

  • Dynamic merge of Appraiser Review answers (tables, paragraphs)
  • Salesforce-initiated CLM document generation and delivery
  • Robust requirements, data, and design documentation

Onboarding

  • Clone docs directory into your Salesforce project repo
  • Review CLM_TEMPLATE_GUIDE.md for template logic and examples
  • See requirements.md for merge field details

Last updated: 2026-02-26 13:23 PM Work in progress: Add quick-start workflow and test recommendations.