Skip to main content
Question

Updating the Envelope with new documents and sending the Envelope does not reflect the updated documents in Docusign

  • March 13, 2025
  • 1 reply
  • 19 views

Forum|alt.badge.img+2

I have installed Docusign App Launcher in my Salesforce developer org. I am using the generate_and_convert REST API to generate the documents and then I am sending these documents using sendEnvelope method of EnvelopeService ApexToolkit. 
I have the requirement of getting a list of documents as and when it comes and then updating them onto an Envelope and finally send the Envelope. For this I have created an empty envelope with a recipient and sent the Envelope with Boolean false.

Contact myContact = [SELECT Id,FirstName,LastName,Email,Phone FROM Contact WHERE Name = 'Test Contact']; 
dfsle.Envelope myEnvelope = dfsle.EnvelopeService.getEmptyEnvelope(new dfsle.Entity('mysourceId'))
    .withRecipients(new List<dfsle.Recipient> {
        dfsle.Recipient.fromSource(
            myContact.FirstName + ' ' + myContact.LastName,
            myContact.Email,
            myContact.Phone,
            'Signer 1',
            new dfsle.Entity(myContact.Id))
    });
myEnvelope = dfsle.EnvelopeService.sendEnvelope(myEnvelope, false);

Once this Envelope is saved in Docusign...I try updating the Envelope with my documents.

List<dfsle.Document> documentList = dfsle.DocumentService.getDocuments(ContentVersion.getSObjectType(), new Set<Id>{myDocId});
system.debug(myEnvelope1.docuSignId);
myEnvelope = dfsle.EnvelopeService.updateEnvelope(myEnvelope)
                .withDocuments(documentList);

Once I finish with this I do sendEnvelope again. However I do not see the documents in Docusign. 
Is this is the way how it should be done. or is there any other way that this can be achieved. 
Thanks for your reply
 

1 reply

Ivan.Dinkov
Docusign Employee
Forum|alt.badge.img+4
  • Docusign Employee
  • 35 replies
  • March 14, 2025

Hi ​@Sravyabm by setting up the value to “false” in 

sendEnvelope(myEnvelope, false);

ApexToolkit creates the envelope as a Draft.

At this time ApexToolkit does not have an option to send Draft envelopes.
The only ways to send these are:

  1. Manually through the Docusign WebUI 
  2. Direct update API call 
  3. Sender View. You can get the Sender View URL through dfsle.EnvelopeService.getSenderViewUrl method. Please refer to the Apex Toolkit reference for more information about this method: https://developers.docusign.com/docs/salesforce/apex-toolkit-reference/envelopeservice.html