salesforce-composite-envelo.../composite-envelope-builder/docs/migrate-docusign-templates-...

7.8 KiB

title
Migrate DocuSign templates from Sandbox to Production using DAL export (Salesforce)

Migrate DocuSign templates from Sandbox to Production — DAL (DocuSign Apps Launcher) export

Purpose

  • Use DocuSign's DAL template export/import to preserve Salesforce merge fields embedded in the DocuSign-for-Salesforce templates (dfsle__EnvelopeConfiguration__c).
  • This document covers exporting templates via DAL from Demo/Sandbox, importing into Production, capturing new template IDs, and updating Salesforce dfsle__EnvelopeConfiguration__c records.
  • Includes instructions to create the Short_Name__c custom field required by our Apex classes and Flow.

Prerequisites

  • DocuSign admin access (Demo/Sandbox + Production) with permission to export/import templates via DAL.
  • Salesforce admin access to create fields and run Data Loader / sfdx commands.
  • dfsle (DocuSign for Salesforce) managed package installed in Production.
  • Optional: sfdx CLI or Data Loader for bulk CSV updates.

High-level steps

  1. Export the DocuSign templates from Sandbox/Demo using DAL export.
  2. Import the DAL package(s) into DocuSign Production.
  3. Capture the new DocuSign template IDs for each imported template.
  4. Create the Short_Name__c custom field on dfsle__EnvelopeConfiguration__c (if missing).
  5. Prepare CSV mapping old→new template IDs.
  6. Update (or insert duplicates of) dfsle__EnvelopeConfiguration__c records in Salesforce.
  7. Validate by sending test envelopes through the Flow/Apex.

Detailed steps

  1. Download templates from the source Salesforce org (DAL)
  • Preconditions: you must have Salesforce and DocuSign admin permissions and DAL (DocuSign Apps Launcher v4.5+) installed in the org.

  • Steps in the source org:

    1. Open the Salesforce App Launcher (grid icon) and select View All.
    2. Select DocuSign Apps Launcher.
    3. In the left column select eSignature to open the eSignature Configuration page.
    4. On the eSignature Configuration page, locate the list of Envelope Templates.
    5. Select the checkbox next to each template you want to download.
    6. From the Create Template dropdown choose Download Template.
    7. The page will refresh and show "Templates downloaded". Save the downloaded file(s) (ZIP) to your device.
      • Note: Salesforce prevents downloading templates larger than 4 MB.
  • Important: templates that include custom fields created by a specific user may not import cleanly into the destination org unless that creating user exists in the destination. Either add the creating user to the destination org before upload, or plan to rebuild the missing custom fields after import.

  1. Import DAL package(s) into DocuSign Production
  • In DocuSign Production, go to the Templates (or Template Management) area and use the Import or Upload DAL package option.
  • Upload each DAL package file exported from Sandbox/Demo.
  • After import, open each imported template and verify that merge fields (placeholders) are preserved and that the template content looks correct.
  1. Capture new template IDs (GUIDs)
  • For each imported template record in Production, record the new template ID (GUID). The template ID is often visible in the template URL (e.g., /templates/{templateId}) or in the template properties.
  • Create a simple mapping list with columns: OldDocuSignId, NewDocuSignId, TemplateName.
  1. Create Short_Name__c on dfsle__EnvelopeConfiguration__c (if not present)

Why: Our Apex and Flow expect a Short_Name__c field as a compact identifier. Create it before inserting/updating records so Short_Name__c values can be included in CSVs and UI pages.

UI steps (recommended):

  1. In Salesforce Setup, open Object Manager.
  2. Search for Envelope Configuration (DocuSign) or look up dfsle__EnvelopeConfiguration__c.
  3. Click Fields & RelationshipsNew.
  4. Select TextNext.
  5. Label: Short Name → API Name will be Short_Name__c → Length: 50 → Next.
  6. Set Field-Level Security (visible to integration/admin profiles) → Next → Save.

Managed-package note

  • Adding custom fields to managed-package objects is supported in subscriber orgs; the custom field's API name will be Short_Name__c (no package namespace).

MDAPI (optional automation)

  • If you prefer to deploy the field via Metadata API, create a field metadata file:
<?xml version="1.0" encoding="UTF-8"?>
<CustomField xmlns="http://soap.sforce.com/2006/04/metadata">
  <fullName>Short_Name__c</fullName>
  <label>Short Name</label>
  <type>Text</type>
  <length>50</length>
  <inlineHelpText>Short identifier used by Apex and Flow</inlineHelpText>
</CustomField>

Place that at deploy/mdapi/objects/dfsle__EnvelopeConfiguration__c/fields/Short_Name__c.field-meta.xml and add the file to deploy/mdapi/package.xml before an sfdx force:mdapi:deploy.

  1. Prepare mapping CSV (old → new)
  • For updating existing Salesforce records (recommended if Flows reference record Ids):
Id,dfsle__DocuSignId__c
00Nxxxxxxxxxxxx,AAAAAAAA-BBBB-CCCC-DDDD-111111111111
00Nyyyyyyyyyyyy,22222222-3333-4444-5555-666666666666
  • For inserting duplicates (preserve old configs):
Name,Short_Name__c,dfsle__DocuSignId__c,dfsle__EmailMessage__c
Invoice Template - EN,INV_EN,AAAAAAAA-BBBB-CCCC-DDDD-111111111111,Please sign the attached invoice
  1. Update or insert dfsle__EnvelopeConfiguration__c records in Salesforce
  • Update (in-place):
# update by Id (bulk upsert)
sfdx force:data:bulk:upsert -s dfsle__EnvelopeConfiguration__c -f updates.csv -i Id -u ORG_ALIAS -w 10
  • Insert (duplicates):
sfdx force:data:bulk:insert -s dfsle__EnvelopeConfiguration__c -f inserts.csv -u ORG_ALIAS -w 10
  • Alternatively use Data Loader / Dataloader.io for GUI-driven imports.

Notes

  • If flows or other automation reference the dfsle__EnvelopeConfiguration__c record Ids directly, prefer updating dfsle__DocuSignId__c in-place.
  • If you want to keep previous configs for rollback or comparison, insert duplicates and then re-point any automation to new records as needed.
  1. Validate end-to-end
  • Query to verify Short_Name__c and new DocuSign IDs:
sfdx force:data:soql:query -u ORG_ALIAS -q "SELECT Id, Name, Short_Name__c, dfsle__DocuSignId__c FROM dfsle__EnvelopeConfiguration__c WHERE Short_Name__c != NULL" --resultformat csv
  • Trigger the Flow or call the Invocable Apex (in Developer Console or by running the Flow in UI) to send a test envelope and confirm the imported template is used and merge fields populate as expected.

Rollback

  • Keep your original export CSV from step 1 as a rollback file. To revert, re-run Data Loader using the backup CSV to restore prior dfsle__DocuSignId__c values.

Troubleshooting

  • If a bulk insert/update fails, check Field-Level Security, API access for the managed-package object, and required fields enforced by the package.
  • If the DAL import does not preserve some merge mappings, capture the problem template and contact DocuSign support — but DAL is the recommended method because it preserves Salesforce-related merge fields.

Appendix

  • Example SOQL to list templates with non-blank Short_Name__c:
SELECT Id, Name, Short_Name__c FROM dfsle__EnvelopeConfiguration__c WHERE Short_Name__c != NULL
  • Example updates.csv:
Id,dfsle__DocuSignId__c
00Nxxxxxxxxxxxx,AAAAAAAA-BBBB-CCCC-DDDD-111111111111
  • Example inserts.csv:
Name,Short_Name__c,dfsle__DocuSignId__c
Invoice Template - EN,INV_EN,AAAAAAAA-BBBB-CCCC-DDDD-111111111111

If you want, I can:

  • Export the current dfsle__EnvelopeConfiguration__c records from an org (provide ORG_ALIAS) and prepare updates.csv/inserts.csv pre-filled with current data.
  • Add the MDAPI field metadata for Short_Name__c into deploy/mdapi/objects/dfsle__EnvelopeConfiguration__c/fields/ and update deploy/mdapi/package.xml for deployment.

Last updated: 2026-04-01