EnvelopeService
A basic flow would be:
// Get an empty envelope definition to begin.
Envelope e = dfsle.EnvelopeService.getEmptyEnvelope(new Entity(sourceId));
// Send envelope and add source documents and recipients
e = dfsle.EnvelopeService.sendEnvelope(e, false);
// Get tagger URL (this must be in a future method or separate transaction to avoid a CalloutException)
Url u = dfsle.EnvelopeService.getSenderViewUrl(e.docuSignId, new Url('https://my.return.url'));
// Host the tagging session with the returned URL
Methods
createEnvelope
dfsle.EnvelopeService.sendEnvelope. This method does not make any API callouts. It involves a DML operation.
The caller must be assigned the DocuSign User permission set.
envelopeenvelopeConfigurationaddFromSourcedeleteEnvelope
dfsle.StatusService.voidEnvelope. This method does not make any API callouts. It involves a DML operation.
The caller must be the owner of the envelope.
envelopeIdgetEmptyEnvelope
This method does not make any API callouts or DML operations.
The caller must be assigned the DocuSign Sender permission set.
sourcegetEnvelope
This method does not make any API callouts or DML operations.
The caller must be the owner of the envelope.
envelopeIdgetSenderViewUrl
When redirected back to the supplied returnUrl, Docusign appends an event parameter to the query string. Possible values include:
sent: The envelope was sent from the tagger. It may be appropriate to initiate signing at this point assuming the first signer or host is the current user.save: The envelope was saved as a draft in Docusign.cancel: The draft was canceled. Delete the envelope via thedfsle.EnvelopeService.deleteEnvelopemethod.error: An error was encountered.
This method involves an API callout with no DML operations.
The caller must be the owner of the envelope.
docuSignIdreturnUrlretryEnvelope
If the envelope cannot be located by transaction ID, an dfsle.APIException will be thrown with error code dfsle.APIErrorCode.NOT_FOUND
This method should be isolated on its own transaction as it involves an API callout followed by a DML operation.
If previously created, the caller must be the owner of the envelope. Otherwise the caller must be assigned the DocuSign Sender permission set.
transactionIdsendNowsaveSentEnvelopes
dfsle.EnvelopeService.sendEnvelopes. This will create envelope and status records for each sent envelope. Each envelope must have valid docuSignId and sent properties and an empty error property, otherwise an exception will be thrown and no envelopes will be saved. Any invalid envelopes should be filtered out prior to calling this method.
This method involves DML operations. It does not make any API callouts.
The caller must be assigned the DocuSign Administrator, DocuSign User, or DocuSign Sender permission set.
ReturnsThe sent envelopes with updated record IDs.Parametersenvelopesfinal List<Envelope> envelopesThe sent envelopes. Seedfsle.EnvelopeService.sendEnvelopes to initiate the transaction.sendEnvelope
DescriptionSends an envelope to Docusign. This will also create the envelope record in Salesforce if necessary. This method should be isolated on its own transaction as it involves an API callout followed by a DML operation.
If previously created, the caller must be the owner of the envelope. Otherwise the caller must be assigned the DocuSign Sender permission set.
ReturnsThe sent envelope.Parametersenvelopefinal Envelope envelopeThe envelope to send. sendNow final Boolean sendNowWhether to send immediately or save as a draft in Docusign. sendEnvelopes
DescriptionImmediately sends one or more Docusign envelopes. This method involves web service callouts to Docusign, but no subsequent DML. It is intended for scenarios where multiple envelopes are sent in a single transaction or whenever else DML should be deferred. At the end of the transaction, dfsle.EnvelopeService.saveSentEnvelopes should be called. Otherwise the associated envelope and status records will not be created.
This call is limited to 99 envelopes at a time, and subject to hourly API and Salesforce Governor limits.
Every envelope must be valid or else a ValidationException will be thrown and no envelopes will be sent. If all envelopes pass validation, any API error for an envelope will be logged on the error property. Only successfully sent ones may be saved with dfsle.EnvelopeService.saveSentEnvelopes.
The caller must be assigned the DocuSign Administrator, DocuSign User, or DocuSign Sender permission set.
ReturnsThe sent envelope.Parametersenvelopesfinal List<Envelope> envelopesThe envelopes to send. Seedfsle.EnvelopeService.saveSentEnvelopes to complete the transaction.updateEnvelope
DescriptionUpdates a draft envelope record in Salesforce, including documents and recipients. This is a more expensive call than dfsle.EnvelopeService.updateEnvelopeNotifications as it updates and recalculates child entries. This method does not make any API callouts. It involves a DML operation.
The caller must be the owner of the envelope.
ReturnsThe updated envelope.Parametersenvelopefinal Envelope envelopeThe envelope to update.