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?
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:
envelopeid from DS
For the remainder, you want to use this sample code
Lastly, I recommend posting this in StackOverflow. There are DocuSign tech people people who monitor and help in that community.