Trending Topics: Latest from our forums (June 2023)

Here are some of the latest popular questions that the Docusign developers community asked on Stack Overflow in the month of June 2023. You too can ask questions by using the tag docusignapi in Stack Overflow.

Thread: Retrieving the Signed Document from Salesforce Files

Summary: The developer is using Docusign eSignature for Salesforce. They want to use the Apex Toolkit to retrieve the signed document from Salesforce.

Answer: In order to do this, the developer needs to identify which file(s) in the Salesforce object represents the signed document stored there after the envelope process was complete. They can do this by specifying the format of the writeback document in the Salesforce configuration, which can be done using the Apex Toolkit. For example, if they want to set the file name as "document name + envelope status", they would need to set WRITE_BACK_NAME_ENVELOPE_STATUS as the value for the second argument of dfsle.Document.WriteBack method. This is what the code would look like:

myEnvelope = myEnvelope.withOptions(new dfsle.Envelope.Options(
        new dfsle.Document.WriteBack(
        new Map<String, Map<String, Object>> {
            dfsle.Envelope.STATUS_COMPLETED => new Map<String, Object> {
                'Opportunity.StageName' => 'Closed Won'
        new Map<String, Map<String, Object>>()

Then it’s just a matter of using Salesforce APIs to retrieve the file from Salesforce.

Thread: Test if its "success" or "fail" or "cancel" after the sign using Docusign

Summary: The developer uses PHP for embedded signing. They’re asking how to determine if the envelope was successfully signed or not from their code. 

Answer:  There are two main ways to do this. The first way is to use an event parameter that Docusign adds to the returnUrl that you set in the embedded signing. The value of the event parameter would be signing_complete if the envelope was signed and cancel if it was canceled (there are other possible values). While this approach is useful, a better approach would be to use Docusign Connect, which is a webhook service that notifies your integration of specific events. This approach works better because it guarantees that your code is aware of the result, even if, for example, the browser was closed. You can then process the event on your server and act accordingly.

Thread: Docusign attachment optional not required in php api

Summary: The developer is using PHP and wants to send an envelope that includes an optional attachment tab. They are trying to set 'required' => "false", similarly to how this is done for other tabs, and it doesn’t work.

Answer: Attachment tabs use a different property to designate that they are optional. The developer should set 'optional' => "true" to make sure the tab is optional.

Additional resources

Inbar Gazit
Inbar Gazit
Sr. Manager, Developer Content