I'm trying to send an email that needs an eSignature using Docusign and Salesforce.

My requirement is to send an email that has an attached document that needs the signature. The attached document is created using Visualforce(rendered as PDF) and populated with fields from an Opportunity record.

So far, I have created an API for DocuSign and am able to send the email with the attachment to the recipient. Reference: http://developer.force.com/cookbook/recipe/accessing-docusign-api-from-salesforcecom-to-send-contracts-for-esignatures

My problem is, even though the email is sent, the status of the Docusign envelope is not tracked. Should I use the DocuSign app instead of using the API and use a custom button? or should I manually create the DocuSign_Status__c records from my code and use other WSDLs to get the status of the envelopes?


2 Answers 2


I solved this problem. I used the SOAP API of DocuSign to create the email (standard email with a visualforce page as the attachment). Reference : http://developer.force.com/cookbook/recipe/accessing-docusign-api-from-salesforcecom-to-send-contracts-for-esignatures

Then I installed the DocuSign App to track the status of the Document sent. App installation and configuration guide https://10226ec94e53f4ca538f-0035e62ac0d194a46695a3b225d72cc8.ssl.cf2.rackcdn.com/docusign-for-salesforce-connect.pdf

The DocuSign App creates the record called 'dsfs__DocuSign_Status__c' even if you send your documents using the API (code given in the reference above). One change you need to do is, if you want your DocuSign Status object to be related to one of your salesforce records (eg: Opportunity, Contract), you have to specify the Id of that salesforce record in your code that creates the envelope.

Example: To relate the Status record to an Opportunity, in the 'SendToDocuSignController' class in the above code, you need to add,

DocuSignAPI.CustomField field = new DocuSignAPI.CustomField ();
field.Name = '##SFOpportunity';
field.Value = opportunity.Id;

envelope.CustomFields = new DocuSignAPI.ArrayOfCustomField();
envelope.CustomFields.CustomField = new DocuSignAPI.CustomField[1];
envelope.CustomFields.CustomField[0] = field;

You can add other records too using the Reserved Custom Field name specified in the DocuSign SOAP API guide. https://www.docusign.com/sites/default/files/DocuSignAPI_Guide.pdf

You can also use the app to implement features(eg: change a field value of Contract record when document is completed) without having to write triggers.


If I were you, I would use the docusign App, and a custom button. if I get time, I'll post example code for the button


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .