17. Agenda Review DocuSign System What is an envelope What are DocuSign accounts and members Review different ways to use DocuSign from Salesforce.com Understand the API function groups Understand the DocuSign system architecture Set up a simple 1-click send scenario Getting started: DocuSign DevCenter
18. DocuSign Envelopes End User Definition: A DocuSign Envelope is a secure digital file containing one or more documents being sent for signature. Documents can be placed into a DocuSign envelope by either ‘printing’ them into the envelope using the DocuSign print helper, or by uploading them. A DocuSign envelope can contain any document you can print, and no special formats are needed. A DocuSign Envelope is a tremendous improvement on a familiar paper metaphor – the overnight express envelope, but it does much more than a traditional envelope can. A DocuSign Envelope is capable of ensuring the proper sequence of signing, makes sure each signer signs, fills out, and initials all the required locations specific to them, and prevents unauthorized users from being able to sign or even see the documents it contains. Computer Science Definition A transaction container which includes documents, recipient information and workflow
27. Walkthrough Step 1: get accounts and set up access Before getting started you need to get a free Salesforce.com developer account at https://developer.force.com and a free DocuSign developer account at www.docusign.com/devcenter. Start out by adding DocuSign webservices to your authorized endpoints for your Salesforce.com developer account. To do this, go to Setup > Security > Remote Sites and add https://demo.docusign.net/api/3.0/dsapi.asmx.
28. Walkthrough Step 2: Set up a site For the purpose of this walkthrough you just need to have a site for testing. You can get to the screen below by clicking Setup > Develop > Sites.
29. Walkthrough Step 3: Create Render Contract Page Page Code: <apex:pagerenderAs="pdf" standardController="Contract"> <apex:detailrelatedList="true" title="true"/> <div style='clear:right;margin-top:50px'> <div style='float:right'>____________________________________</div> <div style='float:right'>By:</div> </div> <div style='clear:right;margin-top:50px'> <div style='float:right'>____________________________________</div> <div style='float:right'>Date Signed:</div> </div> </apex:page> The page needs to be added to the site to ensure that you can access it for testing. You can accomplish that by going to the site detail and selecting Site VisualForce Pages. The other setting that has to be adjusted for testing is adding Contracts as something that is accessible from this site. To accomplish this go to Public Access Settings and edit the standard object permission.
30. Walkthrough Step 4: Create The Proxy Class Sending WSDL: https://demo.docusign.net/api/3.0/Schema/dsapi-send.wsdl Go to the Apex Classes and select “Generate from WSDL”. When the class generator asks you to supply a class name, we suggest that you overwrite the class name with DocuSignAPI.
31. Walkthrough Step 5: Create Custom Controller public with sharing class SendToDocuSignController { private final Contract contract; public String envelopeId {get;set;} private String accountId = ''; private String userId = ''; private String password = ''; private String integratorsKey = ''; private String webServiceUrl = 'https://demo.docusign.net/api/3.0/dsapi.asmx'; public SendToDocuSignController(ApexPages.StandardController controller) { this.contract = [select Id, CustomerSignedId, AccountId, ContractNumber from Contract where id = :controller.getRecord().Id]; envelopeId = 'Not sent yet'; SendNow(); } public void SendNow() { DocuSignAPI.APIServiceSoapdsApiSend = new DocuSignAPI.APIServiceSoap(); dsApiSend.endpoint_x = webServiceUrl; //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); DocuSignAPI.Envelope envelope = new DocuSignAPI.Envelope(); envelope.Subject = 'Please Sign this Contract: ' + contract.ContractNumber; 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 System.debug('Rendering the contract'); PageReferencepageRef = new PageReference('/apex/RenderContract'); pageRef.getParameters().put('id',contract.Id); Blob pdfBlob = pageRef.getContent(); // 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; // Recipient System.debug('getting the contact'); Contact contact = [SELECT email, FirstName, LastName from Contact where id = :contract.CustomerSignedId]; 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; // This setting seems required or you see the error: // "The string '' is not a valid Boolean value. // at System.Xml.XmlConvert.ToBoolean(Strings)" recipient.RequireIDLookup = false; envelope.Recipients = new DocuSignAPI.ArrayOfRecipient(); envelope.Recipients.Recipient = new DocuSignAPI.Recipient[1]; envelope.Recipients.Recipient[0] = recipient; // Tab DocuSignAPI.Tab tab1 = new DocuSignAPI.Tab(); tab1.Type_x = 'SignHere'; tab1.RecipientID = 1; tab1.DocumentID = 1; tab1.AnchorTabItem = new DocuSignAPI.AnchorTab(); tab1.AnchorTabItem.AnchorTabString = 'By:'; DocuSignAPI.Tab tab2 = new DocuSignAPI.Tab(); tab2.Type_x = 'DateSigned'; tab2.RecipientID = 1; tab2.DocumentID = 1; tab2.AnchorTabItem = new DocuSignAPI.AnchorTab(); tab2.AnchorTabItem.AnchorTabString = 'Date Signed:'; envelope.Tabs = new DocuSignAPI.ArrayOfTab(); envelope.Tabs.Tab = new DocuSignAPI.Tab[2]; envelope.Tabs.Tab[0] = tab1; envelope.Tabs.Tab[1] = tab2; System.debug('Calling the API'); try { DocuSignAPI.EnvelopeStatuses = dsApiSend.CreateAndSendEnvelope(envelope); envelopeId = es.EnvelopeID; } catch ( CalloutExceptione) { System.debug('Exception - ' + e ); envelopeId = 'Exception - ' + e; } } }
33. Walkthrough Step 7: Creating the 2nd Page <apex:pagestandardcontroller="Contract" extensions="SendToDocuSignController"> <h1>Your eSignature request is being sent to DocuSign API!</h1> <hr/> <apex:form > <apex:commandButton value="Send Again!" action="{!SendNow}"/> </apex:form> <hr/> <strong>The DocuSign EnvelopeId:</strong>{!envelopeId}<br/> </apex:page> Now you can test the controller class: http://devcenter-demo-developer-edition.na7.force.com/SendToDocuSign?id=800A0000000Q8ol
34. Walkthrough Step 8: Adding a button Go to Setup > Customize > Contracts > Buttons and Links and create a New button. In the properties, select Detail Page Button and then add the URL with the Contract Id: /apex/SendToDocuSign?id={!Contract.Id} Add the button to the page layout for the Contract object.
35. Getting Started: DevCenter and Professional Services Free Sandbox Account SDK Sample Code Forums Webinars Professional Services Over 350 Integrations Design, Architecture and Implementation
36. Hour 3: Using the DocuSign API Presenter: Julia Ferraioli
37. DocuSign API Resources SDK with example projects in C# Java PHP Ruby Apex hosted at https://github.com/docusign/DocuSign-eSignature-SDK Active developer community hosted http://community.docusign.com/ broken down by language and topic Online/Offline API documentation http://www.docusign.com/p/APIGuide/APIGuide.htm http://www.docusign.com/blog/wp-content/uploads/2011/02/DocuSignAPIDevGuide_02102011.pdf
38. Live Coding Demo Using .NET framework Follow along in the cookbook posted on the forums: http://community.docusign.com/t5/DocuSign-API-Integration-NET/C-DocuSign-Cookbook/m-p/2747#M218
39. Hour 4: Successfully Completing DocuSign Certification Presenter: Julia Ferraioli
40. Outline Why do I need to certify? DocuSign Marketplace When certification is necessary Fees and other information How to be prepared for the meeting Preparing a demo Sample demo, or the meta-demo What happens after certification Next steps…
41. Why do I need to certify? Important change from the demo environment to production environment Need to ensure that the behaviors that occur in development are sustainable and scalable Confirm that the application complies with certain guidelines and standards Most of all, we want to make you as successful as possible!
42. DocuSign Marketplace Listing of applications that add value to the DocuSign service Being included in the DocuSign Marketplace gives you access to reviews, download statistics and greater visibility Getting certified gives you the option of being included in the DocuSign Marketplace!
43.
44.
45. How to be prepared for the meeting Fill out your certification checklist Prepare a demo of your integration Make sure you can explain the security protocols of your integration Test your error handling for when you cannot reach DocuSign Know how to capture the trace of an envelope Audit your own API calls
46. Preparing a demo When preparing your demo, you will want to test several use cases. Some cases are: User declines to sign User’s information is incorrect Sender voids the envelope User takes more than one session to sign Application cannot connect to DocuSign Someone resets your DocuSign credentials
47. API Rate Limits in Place! To maintain reliability and stability within our demo and production environments, DocuSign has operated with certain API call efficiency guidelines. To ensure effective load balance, we continually monitor the API calls in our backend systems and reach out to work with developers putting unnecessary burden on the system. Going forward, DocuSign will implement an API Call Rate Limit to further balance loads on the system. Effective March 1, the demo environment (demo.docusign.net) will be limited to a call rate of 1,000 API calls per hour per account Effective April 1, the production environment (www.docusign.net) will be limited to a call rate of 1,000 API calls per hour per account Please note that when the API call rate limit is reached you will receive an exception on every call for up to 60 minutes, until the next hour starts.
54. Next steps… Change your endpoints to point to production Cease any polling behaviors you may have in our demo environment Remember, our demo environment is only for active development Continue to use our demo environment for any code changes Production is for code that has been thoroughly developed, tested and certified Remember, re-certification is only necessary for new functionality, code paths or framework changes