Attaching a visualforce page rendered as PDF to Docusign email

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.

Tags:

Docusign