DocuSign Integration With Salesforce Using API

DocuSign for Salesforce helps us shorten sales cycles, increase close rates, increase productivity, and reduce paper waste, resulting in savings of time. It allows us to quickly pull data from Salesforce objects like Lead, Account, Contact, Opportunity etc.

Introduction:

DocuSign for Salesforce helps us shorten sales cycles, increase close rates, increase productivity, and reduce paper waste, resulting in savings of time. It allows us to quickly pull data from Salesforce objects like Lead, Account, Contact, Opportunity etc. and then either sign documents online, or send them out for signature directly from Salesforce. The signed documents are then returned to Salesforce and attached to the corresponding salesforce records.

Why Choose Docusign?

  • Merge Fields Embed the Power of Salesforce into your Documents 

DocuSign allow us to make use of Salesforce (merge) fields, by simply dragging and dropping data fields into vital documents. This never requires any programming knowledge, which results in reduced operating costs.

  • Accurate & Secure Transactions 

DocuSign provides 100% accurate & secure transactions, reduces employee time spent on handling and tracking documents, and eliminates costs of paper, ink, printing, faxing and mail. The transaction details are tracked in existing systems as well as Salesforce.

  • Collaborate in the Cloud

Users can leverage DocuSign for Salesforce to close deals in the cloud and resend to all signing parties to accept. Changes are tracked throughout the process, so users always know what was changed, when and who signed off.

  • Single Sign On with your Salesforce Password  

It also provides Single Sign On facility; so users can automatically log into DocuSign with their existing Salesforce username and password, and the user is n0t required to remember and manage multiple passwords.

 Steps to create DocuSign Developer Account

Step 1 : Go to the following url to create DocuSign developer account,

https://www.docusign.com

Step 2 : Now, click the ‘Get a Free Dev Account’ button. (For trial version)

docusign salesforce integration

Step 3 : Next, fill in all the fields with appropriate information and then click the ‘Get Started’ button.

Note: Specify a valid email address to receive the activation code.

docusign salesforce integration

Step 4 : Now, check your email and click the ‘Account Activation’ message.

docusign salesforce integration

Step 5 : Next, click the ‘Activate’ button.

docusign salesforce integration

Step 6 : Now, enter the password and security question and then click the ‘Activate’ button.

docusign salesforce integration

Step 7 : Your DocuSign developer account is created successfully. Finally, remember this username and password.

docusign salesforce integration

Steps to install DocuSign in Salesforce

Step 1 : Go to the following App Exchange url to install DocuSign application,

https://appexchange.salesforce.com/listingDetail?listingId=a0N30000001taX4EAI

Step 2 : Now, click the ‘Log In’ button.

docusign salesforce integration

Step 3 : You can log into the AppExchange using one of the following methods.

  • Using Salesforce Production Credential (if you have the production credential) or
  • Using Salesforce Developer Edition Credential.
docusign salesforce integration

Step 4 : Next, click the “Get It Now” button.

docusign salesforce integration

Step 5 : Now,click the ‘Install in sandbox’ button to install the DocuSign application on a Sandbox. For Production, click ‘Install in Production’

docusign salesforce integration

Step 6 : Next, enable the checkbox and then click the ‘Confirm and Install’ Button to continue installation process.

docusign salesforce integration

Step 7 : Enter the sandbox login credentials, and then click the ‘Log in to Salesforce’ button.

docusign salesforce integration

Step 8 : Now, you will see the list of Package components and the version details of the application. Click the ‘Continue’ button to install.

docusign salesforce integration

Step 9 : Review the third-party access information.  This shows a list of websites that the package might send data to or receive data from during operations. Finally, enable the checkbox and then click the ‘Continue’ button.

docusign salesforce integration

Step 10 : Approve Package API Access.  Review the information on the page and then click the ‘Next’ button to continue the installation process.

docusign salesforce integration

Step 11 : Choose the security level. The security level determines user access to DocuSign for Salesforce. DocuSign recommends you select ‘Grant access to all users’ (you can change user access later through the DocuSign Admin tab) and then click the ‘Next’ to continue.

docusign salesforce integration

Step 12 : Click the ‘Install’ button to complete your installation process.

Steps to configure the installed Package

Step 1 : After installation, Go to App Setup Deploy Installed Packages,find the ‘DocuSign for Salesforce’ package and then click the ‘Configure’ button to start the configuration.

docusign salesforce integration

Step 2 : Now, you will be redirected to ‘Configuring Docusign For Salesforce’ page.

  1. Enter the Email and password of Docusign Developer Account.
  2. Set the Environment to demo for trial version.
  3. And then click the ‘Log in’ button.
docusign salesforce integration

Step 3 : In order to enable a Salesforce connection to DocuSign, you must add DocuSign as a trusted network and connect your Salesforce account to DocuSign.  Add all four IP ranges as follows

docusign salesforce integration

A pop-up window with the Salesforce Network Access Trusted IP Range Edit window opens and the IP range information is shown.

docusign salesforce integration
  • Click Save. Do not modify the IP range. The range is populated automatically with the correct values for remote access to the DocuSign data centers.
  • Close the Network Access pop-up window.

Repeat the ‘Add IP Range’ steps for each of the remaining Add IP Range buttons. After adding all four ranges, you will have the following IP ranges listed in Salesforce Network

Access as Trusted IP Ranges:

  • 209.67.98.1 through 209.67.98.63
  • 206.25.247.129 through 206.25.247.159
  • 209.46.117.161 through 209.46.117.191
  • 162.248.184.1 through 162.248.187.255

Step 4 : Now go to ‘Connect DocuSign to Salesforce’ section and enter the following information:

  • Enter the Salesforce Username and Password
  • Select the Saleforce Environment to Sandbox for trial version.
  • And then click the ‘Next’ button.
docusign salesforce integration

Step 5 : Finally, click the ‘Done’ button to connect with Docusign developer account.

docusign salesforce integration

Integrator Key:

Once the connection is created between Salesforce and Docusign, next we need the Integration Key. This key is a Unique Identifier for each DocuSign integration. An Integrator Key is required for all integrations, and if you want to move to Production, the Integrator Key must be authorized by DocuSign for Production.

All Integrator Keys are used for development first, and as a result, they are all managed (and requested) in DocuSign’s DEMO service. If you already have a DocuSign Developer account (demo), log into the account and request an Integrator Key. If you do not have a Demo Developer Account, go to the DocuSign Developer Center: https://www.docusign.com and request a free account. After development is done using Demo Integrator Key, then we must get that Integrator Key certified before moving to production.

Important: Web service calls made without an Integrator Key will receive an exception for every call made. The exception message states, “The specified Integrator Key was not found or is disabled”.

Sample Code :

In order to use DocuSign API, you need to retrieve your DocuSign API credentials. Go to https://demo.docusign.net, sign into your demo account, and then go to Preferences -> API. There you will find these values:

Integrator’s Key: ZORO-a81ec71a-cb17-4af0-b1aa-9513115cbf02

API UserName: 0e212ae6-1e12-40c1-8f5a-a57458ccaa63

API Password: <your current password>

API Account ID: 736e7948-6861-4ef3-ae71-4c56603dc14f

//Set Authentication:

String auth = ‘<DocuSignCredentials><Username>’+ userId

+'</Username><Password>’ + password

+ ‘</Password><IntegratorKey>’ + integratorsKey

+ ‘</IntegratorKey></DocuSignCredentials>’;

System.debug(‘Setting authentication to: ‘ + auth);

dsApiSend.inputHttpHeaders_x = new Map<String, String>();

dsApiSend.inputHttpHeaders_x.put(‘X-DocuSign-Authentication’,auth);

//Add Document:

DocuSignAPI.Document document = new DocuSignAPI.Document();

document.ID = 1;

document.pdfBytes = EncodingUtil.base64Encode(pdfdocument);

document.Name = ‘Contract’;

document.FileExtension = ‘pdf’;

envelope.Documents = new DocuSignAPI.ArrayOfDocument();

envelope.Documents.Document = new DocuSignAPI.Document[1];

envelope.Documents.Document[0] = document;

//Add Recepient:

DocuSignAPI.Recipient recipient = new DocuSignAPI.Recipient();

recipient.ID = 1;

recipient.Type_x = ‘Signer’;

recipient.RoutingOrder = 1;

recipient.Email = ‘Test@gmail.com’;

recipient.UserName = ‘TestName’;

//Calling the API to send Document to the Recepient

DocuSignAPI.EnvelopeStatus es = dsApiSend.CreateAndSendEnvelope(envelope);

Docusign certification process

Once the development is done in the demo environment, applications must go through a certification process to deploy the application in production environment. DocuSign Certification Review team will examine the application to ensure following development best practices have been followed.

1. API Certification Checklist

Here, we need to provide the basic information regarding our application, company name, technical and business contacts, and technical and business insight on how you plan to work with DocuSign and the API.

2. A video demonstrating the application

We need to provide a video demonstrating end-to-end functionality of our application. This video should clearly explain the user experience from both the sender and signer perspective. Also, it should include all “signing” options, including Decline to Sign, Sign on Paper, Finish Later, Change Signer, etc.

3. Screen shots of exception handling messages

The exception handling screen shot must expose what users observe when signing and sending the documents fail due to an unexpected error. We must show a friendly error message with specific contact information to our support staff such as email and/or phone.

4. JSON, SOAP, or XML HTTP/s web service request and response trace

The Trace must clearly show the request and response including headers, and the Docusign should be able to recreate the event using the provided trace. The provided trace must also contain URI, endpoint, authentication method, credentials, and payload etc.

5. Single date indicating at least 20 test transactions

The log file should contact twenty test transactions to show the integration from end-to-end. The tests need to be on a single day and without interference of other testing. These tests must be run using the Integrator Key provided in the Checklist for promotion. For a given date, DocuSign will pull our server logs to validate no errors occurred and best practices are being followed like caching, and will focus around how the application polls status of the document.

6. Details on how status is obtained via Connect, Fetch, or API

Provide a detailed description of how envelope status is obtained via Connect, Fetch, or API. Docusign will check the server log to ensure best practices have been followed.

Conclusion

DocuSign is a powerful Digital Transaction Management tool that allows businesses to share documents with their customers for electronic signature easily, securely and efficiently in the Cloud.

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.