DocuSign for Salesforce - How to write a date back to Salesforce

Issue

I want a signer to enter a date in DD/MM/YYYY format and have that data write back to Salesforce into a Date field suitable for reporting.

Note that if you are trying to format a date from Salesforce in to a DocuSign envelope, a guide is available here.

Solution

Custom fields need to be created in Salesforce: The data must be written back to a Text field. A Formula field can then be used to process it into a Salesforce-readable date.

In Salesforce

  1. Navigate to Setup > Customize
  2. Under the object you will be writing back to, select Fields then New in the Custom Fields section
  3. Create a Text field, enter a Field Label and Field Name as appropriate (Example: CloseDateText)
  4. Establish Field-Level Security and Layouts as appropriate. The DocuSign Connect user profile will need Visible access to the field to create the Merge Field in DocuSign
  5. Select Save & New
  6. Select Data Type: Formula
  7. Select Output type: Date and enter a Field Label and Field Name (Example:CloseDateFormatted)
  8. Enter the following Advanced Formula, replacing CloseDateText with the field name used for the text field:

DATE(

/* DATE function uses YYYY MM DD format */

/* Swap middle and bottom sections if using American date format *\

/* Year Logic */

VALUE(RIGHT(CloseDateText__c, 4)),

/* Month Logic */

VALUE(MID(DateText__c,

FIND("/",CloseDateText__c) + 1,

FIND("/",CloseDateText__c, FIND("/",CloseDateText__c) + 1) -

FIND("/",CloseDateText__c) - 1

)),

/* Day Logic */

VALUE(LEFT(CloseDateText__c,

FIND("/",CloseDateText__c) - 1))

)

  1. Establish Field-level Security as appropriate. Field will always be Read-Only, but should be visible to anyone who will need read access to it.
  2. Add to Layouts as desired

Once the fields are added to the Salesforce object, you will need to create a Merge Field in DocuSign to write back to the text field. You can either do this by logging in to DocuSign directly, or from the Custom Tags section available in the DocuSign Admin panel.

In Salesforce:

  1. Navigate to DocuSign Admin > Custom Tags > New
  2. Enter a Custom Tag Name
  3. Check Relate Field To Salesforce
  4. In the dropdown, select the Object (Example: Opportunity(Reference)) and the DateText field you created previously
  5. Check Allow Writeback, leave Type as Text Field
  6. Set Required, Read Only, Shared and Formatting properties as desired
  7. Change Validation to Regular Expression. Use the following RegEx Pattern to enforce DD/MM/YYYYY format:

^(0?[1-9]|[12][0-9]|3[01])[\/\-](0?[1-9]|1[012])[\/\-]\d{4}$

  1. Fill in Error Message and Tooltip as desired
  2. Enter an Anchor Text string if one is to be used
  3. Save the custom tag. If you will be using it in a template, place it where appropriate.