diff --git a/composite-envelope-builder/QUICK_START.md b/composite-envelope-builder/QUICK_START.md index 8ba2f90..4a4029f 100644 --- a/composite-envelope-builder/QUICK_START.md +++ b/composite-envelope-builder/QUICK_START.md @@ -131,7 +131,8 @@ See `docs/deployment-guide.md` section 5 for detailed Flow configuration steps. - `templateIds` → `{!SelectedTemplateIds}` (from checkboxes) - `recordId` → `{!recordId}` - `language` → `{!SelectedLanguage}` - - `emailSubject` → "Please review and sign these forms" + - `emailSubject` → "Please review and sign these forms" + - Note: The Apex layer will prefix the subject with `Docusign: ` automatically and will truncate the final subject to 100 characters to satisfy Docusign limits. 5. Store outputs: - `envelopeId` → `{!EnvelopeId}` - `success` → `{!Success}` diff --git a/composite-envelope-builder/docs/DEPLOYMENT_AND_TESTING.md b/composite-envelope-builder/docs/DEPLOYMENT_AND_TESTING.md index 6abe83e..feae5c7 100644 --- a/composite-envelope-builder/docs/DEPLOYMENT_AND_TESTING.md +++ b/composite-envelope-builder/docs/DEPLOYMENT_AND_TESTING.md @@ -357,7 +357,7 @@ After successful deployment, configure your Salesforce org: - **Salesforce Record ID** — {!Record.Id} - **Language** — en or es - **Email Subject** — Optional custom subject - - **Authorization to Release Form Copies** — Number of copies (1–3) for the Authorization to Release Information template; populated by the `authReleaseFormCopies` flow variable (defaults to 1) + - **Authorization to Release Form Copies** — Number of copies (1–5) for the Authorization to Release Information template; populated by the `authReleaseFormCopies` flow variable (defaults to 1) 4. Output Variables: - **Envelope ID** — Unique Docusign envelope ID - **Success** — Boolean (true/false) diff --git a/composite-envelope-builder/docs/api-reference.md b/composite-envelope-builder/docs/api-reference.md index 9e88416..02a5ade 100644 --- a/composite-envelope-builder/docs/api-reference.md +++ b/composite-envelope-builder/docs/api-reference.md @@ -50,7 +50,7 @@ Accept: application/json ```json { "status": "sent", - "emailSubject": "Please review and sign these forms", + "emailSubject": "Docusign: Please review and sign these forms", "compositeTemplates": [ { "compositeTemplateId": "1", @@ -74,6 +74,14 @@ Accept: application/json } ``` +### 2.5 Email subject & body composition + +The Apex layer composes the outgoing email subject and body when building the envelope. Important rules: + +- Subject: Prefixed with "Docusign: " to make the source clear to recipients. The subject is truncated to 100 characters to satisfy Docusign limits. +- Body: Consists of a greeting, followed by combined template bodies separated by a visual divider, followed by a sign-off. The system supports English (default) and Spanish; the Flow `language` input accepts locale codes (e.g. `es`, `es-CO`) and common strings like `Spanish`/`Español` to select Spanish greetings/signoffs. + + #### Advanced Example (with merge fields) ```json diff --git a/composite-envelope-builder/docs/design.md b/composite-envelope-builder/docs/design.md index c3cd7ef..b985425 100644 --- a/composite-envelope-builder/docs/design.md +++ b/composite-envelope-builder/docs/design.md @@ -144,8 +144,8 @@ public class Request { @InvocableVariable(required=false label='Email Subject') public String emailSubject; - @InvocableVariable(required=false label='Authorization to Release Form Copies') - public Integer authReleaseFormCopies; // 1–3; only used when that template is selected + @InvocableVariable(required=false label='Authorization to Release Form Copies') + public Integer authReleaseFormCopies; // 1–5; 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 @@ -279,7 +279,7 @@ The following new elements were added to `Docusign_Envelope_Templates_V3`: | `Authorization_Copies_Screen` | Screen | Shows instruction text + radio buttons (1–5 copies) | | `authReleaseFormCopies` | Variable (Number, default 1) | Stores the user's copy-count selection | | `authReleaseTemplateSelected` | Variable (Boolean, default false) | Flag set during the scan loop | -| `AuthCopies_1/2/3` | Choices | Radio button options with numeric values 1 / 2 / 3 | +| `AuthCopies_1/2/3/4/5` | Choices | Radio button options with numeric values 1 / 2 / 3 / 4 / 5 | The `authReleaseFormCopies` variable is passed to the Apex Invocable Action as a new input parameter. @@ -300,9 +300,9 @@ Check_Row_Selection → Scan_For_Auth_Release_Template (loop) **`DocusignEnvelopeRequest.cls`** — new `@InvocableVariable`: ```apex @InvocableVariable( - label='Authorization to Release Form Copies' - description='Number of times to include the Authorization to Release Information template (1-3).' - required=false + label='Authorization to Release Form Copies' + description='Number of times to include the Authorization to Release Information template (1-5).' + required=false ) global Integer authReleaseFormCopies; ``` @@ -313,7 +313,7 @@ global Integer authReleaseFormCopies; // Expand multi-copy templates List expandedTemplateIds = new List(req.templateIds); Integer copies = (req.authReleaseFormCopies != null && req.authReleaseFormCopies > 1) - ? Math.min(req.authReleaseFormCopies, 3) : 1; + ? Math.min(req.authReleaseFormCopies, 5) : 1; if (copies > 1) { List multiCopyIds = [ SELECT dfsle__DocuSignId__c FROM dfsle__EnvelopeConfiguration__c @@ -620,6 +620,28 @@ Map envelope = new Map{ String envelopeJSON = JSON.serialize(envelope); ``` +### 4.3 Email subject and body composition + +The Apex layer composes the envelope's email subject and body before sending. Key rules: + +- Subject: Prefixed with `Docusign: ` to make the source explicit for recipients. The final subject is truncated to 100 characters (Docusign requirement). +- Body: Built as Greeting → template bodies (joined with a visual divider) → Sign-off. The divider is a short visual separator (`\n\n` + 40 `─` characters + `\n\n`). +- Greeting/Sign-off: Support English (default) and Spanish. The Flow's `language` input may be a locale code (`es`, `es-CO`) or a user-friendly string (`Spanish`, `Español`). The code normalizes and accepts common Spanish forms and uses Spanish greeting/signoff when detected. + +Example (English): + +Greeting: `Hello,\n\nPlease complete the DocuSign signature request from Early Intervention Colorado.\n\n` + +Sign-off: `\n\nThank you,\nEarly Intervention Colorado` + +Example (Spanish): + +Greeting: `Hola,\n\nPor favor, firme la solicitud de DocuSign de parte de Intervención Temprana Colorado.\n\n` + +Sign-off: `\n\nGracias,\nIntervención Temprana Colorado` + +Note: If the Flow's `language` value is blank or unrecognized, English is used as the default. + --- ## 5. API Integration Details @@ -876,4 +898,4 @@ Accept: application/json |---------|------|--------|---------| | 1.0 | 2026-02-23 | Paul Huliganga | Initial release | | 1.1 | 2026-03-11 | Paul Huliganga | Added section 2.4 — multi-copy Authorization to Release Information feature; updated component diagram, Request inner class, and sequence diagram | -| 1.2 | 2026-03-13 | Paul Huliganga | Added section 2.5 — SMS delivery via `dfsle.Recipient.withSmsDelivery()` for recipients without email; added Flow V4 description, `SMS_PLACEHOLDER_EMAIL` constant, `recipientSmsPhone` parameter; updated component diagram and Request class docs | +| 1.2 | 2026-03-13 | Paul Huliganga | Added section 2.5 — SMS delivery via `dfsle.Recipient.withSmsDelivery()` for recipients without email; added Flow V4 description, `SMS_PLACEHOLDER_EMAIL` constant, `recipientSmsPhone` parameter; increased multi-copy support to 5 copies; prefixed envelope subject with `Docusign: ` and truncated to 100 chars; added Spanish greeting/signoff and expanded language detection (e.g., 'es', 'es-CO', 'Spanish', 'Español'). |