1

We are currently developing an app in Salesforce for docusign in which when we click on a button called, 'Send to Docusign', an Apex code is run and this will push the pdf to Docusign for signing.

Now once the pdf is in Docusign, the client must sign it and then once done, the pdf should be retrieved by Salesforce and then added to the Notes & Attachments section.

Basically, the flow of our app should be:

1 - User clicks on 'Send to Docusign' button in Contracts object

2 - An apex code is run that pushes a PDF to Docusign

3 - Client signs Docusign

4 - Salesforce retrieves signed PDF and adds it to Notes & Attachments

Now we've pretty much figured out 1 to 3 and now we're just brainstorming on 4.

Is this possible?

I'm thinking we might need to code a REST or SOAP function in Salesforce to retrieve the signed PDF but might there be even a simpler solution to this?

Is it possible that it is Docusign that will automatically return the PDF once it is signed and we no longer have to query Docusign from Salesforce if whether the PDF is signed or not?

Thanks.

4

Yes it's possible, and there is a docusign to Salesforce managed package that lets you connect the two platforms. However if you want to do the custom route because you're productizing this, here is what you would do:

  • On the docusign side, you would create a webhook that would notify salesforce when the docusign status record has a status of completed. On the salesforce side, you could support that with a site. You need the envelopeid from DS
  • In Apex, authenticate and callout to DS.
  • For the envelope get a list of documents that are contained in it. here is some sample code

For the remainder, you want to use this sample code

  • After you have the name or ID of the document to download, use the following procedure to download the document:
  • Instantiate the Docusign API client.
  • Set the following default request header to add your access token (obtained using any of the DocuSign authentication flows or, for testing purposes, the OAuth Token Generator) to all API calls.
    • "Authorization" : "Bearer {Access Token String}"
  • Initialize the Envelopes API.
  • Call the GetDocument API method with your integration key, the ID of the envelope containing the document, and the ID of the document.
  • Specify the output filename, if desired. Confirm the compatibility of the document format prior to deployment in production.

Lastly, I recommend posting this in StackOverflow. There are DocuSign tech people people who monitor and help in that community.

  • Ok thanks for the answer. I've informed my team regarding this and we're currently looking at your examples first. They look really promising and I think this is indeed what we're looking for. I'll get back to you after we've done our own investigation. Thanks. – Jerard Dela Victoria Jul 4 at 6:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.