DocuSign eSignature for Salesforce - How to write a date back to Salesforce
This article pertains to DocuSign eSignature for Salesforce.
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.
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.
- Navigate to Setup > Object Manager.
- Select the object you're working with. Under the object you will be writing back to, select Fields & Relationships then New in the Custom Fields section.
- Create a Text field, enter a Field Label and Field Name as appropriate (Example: CloseDateText).
- 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.
- Select Save & New.
- Select Data Type: Formula.
- Select Output type: Date and enter a Field Label and Field Name (Example:CloseDateFormatted).
- Enter the following Advanced Formula, replacing CloseDateText with the field name used for the text field:
/* DATE function uses YYYY MM DD format */
/* Swap middle and bottom sections if using American date format *\
/* Year Logic */
/* Month Logic */
FIND("/",CloseDateText__c) + 1,
FIND("/",CloseDateText__c, FIND("/",CloseDateText__c) + 1) -
FIND("/",CloseDateText__c) - 1
/* Day Logic */
FIND("/",CloseDateText__c) - 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.
- 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.
- Navigate to Settings > Document Custom Fields > Add Field.
- Enter a Name.
- Check Relate Field To Salesforce.
- In the dropdown, select the Object (Example: Opportunity(Reference)) and the DateText field you created previously.
- Check Allow Writeback, leave Type as Text Field.
- Set Required, Read Only, Shared and Formatting properties as desired.
- Change Validation to Regular Expression. Use the following RegEx Pattern to enforce DD/MM/YYYYY format:
- Fill in Error Message and Tooltip as desired.
- Enter an Anchor Text string if one is to be used.
- Save the custom field. If you will be using it in a template, place it where appropriate.