DocuSign Connect Using Custom Button in Salesforce

DDP (Dynamic Document Package) After you have successfully installed Nintex Draw loop, you can start creating relationships for your Salesforce data, creating templates to generate documents based on the data, and can specify where and how output documents should be delivered. You store all this data in the app. This is the Document Package. To install Draw Loop, click here.DDP is used to generate the document dynamically with Salesforce record values. We can use multiple documents in a single DDP record. We can run draw loop as a custom button, custom links, and from Apex code. In draw loop, while creating DDP record, we will see six tabs:Basics Delivery Options Relationships Insert-Updates Tag Document DDP Files Basics: Here is a starting place to create DDP record.In this tab, we can give the name for the DDP record. We can specify the which type of the document like Quote, letter, contract. Give the name of the result document We can specify the main object and from where we need to run the DDP record We can enter the security options and who can run the DDP record by giving the profile access. Delivery Options: In this tab, we can select the delivery option like download, store document, Salesforce email, DocuSign, SMTP, Document Queue, Content Delivery. We can specify resultant document type--whether it will be PDF or original document type what we upload like the word, PowerPoint. Relationships: Here, we can create the relationship record from standard or custom object to access the Salesforce record values in the document from multiple objects. Insert-Updates: In this tab, we can select actions like field update, task creation, and chatter post for each time while running the DDP record. Tag Document:From this tab, we can get the Salesforce record field tag based on the main object selection to merge with the document. DDP Files: This is the place where we are going to upload the document while we run the draw loop each time. Advantages of Draw Loop: Since it is managed package, everything is a configuration only No need to worry about maintenance No need to write the logic and test classes Support for Word, PDF, PowerPoint, and Excel. We can use multiple documents at a time in one DDP record We can integrate with DocuSign and get electronic signature We can use field update, task creation like workflow action and chatter post. User Access: Each user needs to be assigned with draw loop license We need to assign “DDP User” permission set for each user to run draw loop We need to assign profiles to get run access at while creating DDP record. To Know more about draw loop, please click here.Conclusion:Draw Loop isEasy to configure We can merge Salesforce records value from multiple objects No need to worry about maintenance Dynamically merged field values Support for SOQL Query We can merge image with documents

DocuSign is an effective and flexible third party tool to keep the bond between businesses and customers by integrating with Salesforce. This article explores more about configurable steps to integrate DocuSign with Salesforce in a much simpler way.

  1. Types of DocuSign Account
  2. Setting up Connect in DocuSign
  3. Creating Custom Tags
  4. Templates
  5. Custom Button Parameters
  6. Demo

Types of DocuSign Account 

There are two types of DocuSign Accounts available. They are:

  1. Developer Sandbox
  2. Production

Developer Account 

  1. Developer Sandbox is the demo account used to test our functionality and then move it to production instance once everything is working fine.
  2. Free Account
  3. Developer Sandbox login URL: https://demo.docusign.net

Production Account  

  1. Main account used to synchronize with Salesforce Production.
  2. Paid Account
  3. Production Account login URL: https://account.docusign.com/#/web/login

Creating the DocuSign Developer Account 

To create a developer account, you need to go to following URL https://secure.docusign.com/signup/develop and fill in the details needed and click on “Get Started”.

Setting up Connect in DocuSign 

Once you have logged in to the DocuSign account, you will find the Preference or account settings to set up the connections. On the top right corner of the DocuSign Account, click on Your name > Preference > Account Administration > Connect.

Custom Tags  

Custom Tags are only supported in certain DocuSign plans. Custom Tags are customized fields that you can create and use in the envelopes. To create a custom tag, go to Preference > Member Options > Custom Tags. Click the Add button.

Editing Custom Tags  

To edit custom tag, go to Preference > Member Options > Custom Tag. Select any one of the tags at a time to enable the Edit button. Click the Edit button to do any changes in the custom tag.

Deleting Custom Tags  

To Delete custom tag/tags, go to Preference > Member Options > Custom Tag. Select any one or all the tags you would like to delete at a time and to enable the Delete button. Click the Delete button to delete the selected custom tag(s).

Templates

Templates are the documents we refer to send through the envelopes. Templates can be created in DocuSign in two ways as shown below,

  1. New Template
  2. Upload Templates

New Template 

Directly create a new template.

File format [Symbol] https://www.docusign.com/DocuSignHelp/Content/supported-file-formats.htm

Note: DocuSign does not support files with password security enabled. To send a file with password security, remove the security setting before uploading the file.

Upload Template 

Upload the .xml file that was downloaded from another DocuSign environment.

Custom Button Parameters 

Custom button configuration is supported by using the Salesforce Custom Buttons and Links functionality to create Detail Page Buttons that contain “On Click JavaScript.” The JavaScript logic determines what custom actions are performed by the button.

Required Parameters 

These parameters are required for all custom buttons: 

DocuSign Envelope ID  

DSEID = 0  

Salesforce Object Source ID  

SourceID = {!SFObject.Id}

This is the Salesforce merge field for the id of the object in which the button is to be placed.

Example: If you are creating a button in the Account Layout, use SourceID = {!Accounts.Id}; if in the Opportunity Layout, use SourceID = {!Opportunity.id}.

Some of the important but optional parameters

OCO [Symbol] One Click Options 

It has two values “Send” or “Tag”. If you use “Send”, then default standard view to send document is not shown; when you directly click the button,  the documents will be sent. For “Tag” , it is vice versa.

RES [Symbol] Reminder and Expiration Settings 

There are six comma-separated settings for this parameter: Remind Via Email, Remind In N Days, Repeat Remind In N Days, Expire-Void Envelope, Expire-Void Envelope In N Days, Warn Expire Void In N Days.

Example: If RES = ‘1,2,3,1,120,3’;, then the system will send an email reminder, the reminder is sent 2 days after the original email, the reminder is repeated every 3 days, the envelope will expire/void, the envelope will expire/void in 120 days, and an email warning that the envelope will expire/void is sent 3 days before the expiration.

CEM [Symbol] Custom Email Message 

The message text string supports the use of custom tags, such as: [FirstName] = sender first name, [LastName] = sender last name, and [Email] = sender email. The text string also supports Salesforce merge fields.

Example: CEM=’Envelope sent by [FirstName] [LastName] ([Email]) for {!Opportunity.Name}’;

CES [Symbol] Custom Email Subject 

A text string with the email subject. This will also support the merge Fields.

CRL [Symbol] Custom Recipient List 

The recipient information can be specified directly, or it can be derived from the object where the button is placed. You can specify multiple comma-separated recipients but the length of the entire CRL string must be 1000 characters or less. Single Recipient name can hold up to 80 characters.

DST [Symbol] DocuSign Template 

This represents the Template Id of the document that is going to be sent to the recipient for signing.

LA [Symbol] Load Attachment 

It contains the values “0” means OFF or “1” means ON. When ON, all items in Attachments are added to the envelope. This parameter is typically used with the DocuSign Template option since the documents are supplied by the template. If no value is supplied, this parameter defaults to ON.

Sample Script 

Install DocuSign For Salesforce in your Salesforce account. Refer the article which will clearly explain the steps to install DocuSign for Salesforce. Go to the object in which you should create DocuSign Button to send documents dynamically and add the following JavaScript to that custom button.

{!REQUIRESCRIPT("/soap/ajax/30.0/connection.js")} 
{!REQUIRESCRIPT("/support/console/30.0/integration.js")} 
{!REQUIRESCRIPT("/apex/dsfs__DocuSign_JavaScript")}  

var CRL; 
var OCO='tag'; 
CRL='Email~{!Contact.Email};LastName~{!Case.Contact}'; 
CES = ‘Sample Email Subject'; 

DST = ‘A7888963-78F6-4C2B-9528-7A9FA99F1B41’; //This is the template Id copied from DocuSign 
 
window.open('/apex/dsfs__DocuSign_CreateEnvelope?DSEID=0&SourceID={!Case.Id}&DST=’+DST+’&CRL='+CRL+'&CES='+CES,'_blank'); //Works on classic view

DST Id can be appended to the script from the DocuSign as below. 

You can follow any one of the below steps to send append DocuSign template Ids in the script parameter.

  1. Copy the Id of the DocuSign Template and paste it here in script.
  2. Create a Multi picklist field to hold the DST Id and split the Ids to give DST in a string separated by comma.
  3. Create separate object and based on condition query in the custom button script. Add to a list and then attach it as a comma separated string.

Reference Links 

  1. To learn more about the steps to install DocuSign for Salesforce in your salesforceenvironment, please check the following link. https://www.mstsolutions.com/blog/content/docusign-integration-salesforce-using-api

About MST

At MST Solutions our cornerstone is to adapt, engage and create solutions which guarantee the success of our clients. The talent of our team and experiences in varied business verticals gives us an advantage over other competitors.

Recent Articles

Work with us.

Our people aren’t just employees, they are key to the success of our business. We recognize the strengths of each individual and allow them time and resources to further develop those skills, crafting a culture of leaders who are passionate about where they are going within our organization.