As Kavindra recently posted, we've got another chance this year to get out there with the Force.com developer community.  If you're a Force.com developer, or you would like to see how easy it is to become a Force.com user, and can get to Seattle next week – we'd love to see you.  Let me tell you about DocuSign, the meetup and how their API enables you to work with the documents you need signed in the cloud.

The meetup will take place on December 15th  at 6:00 PM.  If you are new to Force.com, we’ll cover an introduction to the platform.  Otherwise, DocuSign will be presenting on basics for using their API for your Force.com application.   There will be food, drinks, swag and a chance to win your own Galaxy S Android phone.  Register now, because seats are going fast.

If you aren’t familiar with  DocuSign, just check it this YouTube video featuring it, Salesforce.com, Chatter and an iPad – you’ll see instantly the value in being able to integrate your Salesforce.com data with electronic document signing and management.

DocuSign was the winner of our Dreamforce 2009 Best Partner App and have a highly rated AppExchange offering, but what seems to be flying under the radar is that they offer an API to developers who may want to customize their usage with DocuSign for their specific organization?  Need a document based on a specific VisualForce page?  Not a problem.  Maybe you want sales to go through a wizard to detail specifics before a contact goes out – no worries.  Simply code what you need using Force.com and then submit to DocuSign when you’re ready.

If you’re a developer and want to try it out for yourself, head over to DocuSign’s developer center and get a free account.  From there you’ll be able to download the SDK with code samples, including one for Force.com.  You can also get a copy of their WSDL, which will require a little editing to be consumable by Apex … but not much, just remove the second binding from it and you’ll be good to go.

Once you have the access keys from their developer center and the web service classes generated by Apex, you can generate what DocuSign refers to as envelopes to hold contact information and a copy of the PDF.  Here’s a snippet where I’ve passed in a version of a Visualforce page using Apex.getCurrentPage().getContentAsPDF() to the envelope:

     DocuSignAPI.Envelope envelope = new DocuSignAPI.Envelope();

     envelope.Subject    = 'Please Sign this Contract: ' + agreement.Name + ' for '+contact.Name;

     envelope.EmailBlurb = 'This is my new eSignature service, it allows me to get your signoff without having to fax, scan, retype, refile and wait forever';

     envelope.AccountId  = accountId;

     // Render the contract

        Blob pdfBlob = body;   

        // Document

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

        document.ID = 1;

        document.pdfBytes = EncodingUtil.base64Encode(pdfBlob);

        document.Name = 'Contract';

        document.FileExtension = 'pdf';

        envelope.Documents = new DocuSignAPI.ArrayOfDocument();

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

        envelope.Documents.Document[0] = document;

 

You can then setup a recipient based on an existing contact in your system:

 

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

        recipient.ID = 1;

        recipient.Type_x = 'Signer';

        recipient.RoutingOrder = 1;

        recipient.Email = contact.Email;

        recipient.UserName = contact.FirstName + ' ' + contact.LastName;

 

And callout to their web service:

 

                try {

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

                    envelopeId = es.EnvelopeID;

                    System.debug('Returned successfully, envelope id = ' + envelopeId );

                  } catch ( CalloutException e) {

                                    System.debug('Exception – ' + e );

                              envelopeId = 'Exception – ' + e;

                        } 

Your contact will get an email from DocuSign with a link to sign the document and you’ll get confirmation once they’ve signed it. The documents are legally binding and backed by a court admissible audit trail. Using DocuSign to support your contract needs allows you reduce overhead while increasing your visibility and tracking of the process. The integration with Salesforce means that you have access with all the data from within your org and utilize any existing workflows or approvals you need. It’s fast, simple and provides your users with a method of obtaining a 100% legally signed document leveraging the power of the cloud … and saving several trees in the process. 

This is only a brief overview of the API – to learn more check out DocuSign’s developer center or if you’re local to Seattle, register for the meetup and learn more about with DocuSign themselves. Bring your laptop and questions and we’ll see you in Seattle.

 

 

Get the latest Salesforce Developer blog posts and podcast episodes via Slack or RSS.

Add to Slack Subscribe to RSS