Skip to navigation

Envelope

View as Markdown
global class Envelope
Description
Representation of a Docusign envelope.
customFields
@AuraEnabled global List<CustomField> customFields
A list of envelope custom fields. These are not persisted via the dfsle__Envelope__c object.
documents
@AuraEnabled global List<Document> documents
A list of documents contained by the envelope.
docuSignId
@AuraEnabled global UUID docuSignId
The Docusign ID of the envelope, assigned when the envelope is sent or a draft envelope is created.
emailMessage
@AuraEnabled global String emailMessage
The message of the email recipients receive. This is contained within the standard Docusign email body.
emailSubject
@AuraEnabled global String emailSubject
The subject of the email recipients receive.
envelopeConfigurationId
@AuraEnabled global Id envelopeConfigurationId
The ID of the configuration used to create the envelope.
error
@AuraEnabled global APIError error
The error returned by the API in multi-send scenarios.
id
@AuraEnabled global Id id
The ID of the associated dfsle__Envelope__c record.
name
@AuraEnabled global String name
The name of the envelope.
notifications
@AuraEnabled global Notifications notifications
The reminder and expiration settings for the envelope.
options
@AuraEnabled global Envelope.Options options
The envelope options controlling default auto-place text and data and document write-back.
recipients
@AuraEnabled global List<Recipient> recipients
A list of recipients who receive the envelope.
sent
@AuraEnabled global Datetime sent
The date and time when the envelope was sent.
source
@AuraEnabled global Entity source
The Salesforce source object for the envelope (e.g. Opportunity or Lead).
transactionId
@AuraEnabled global UUID transactionId
Sender-generated identifier of the envelope used to prevent envelopes from being sent multiple times in cases where the status is indeterminate. For example, when the network connection drops while waiting for a response. This value is valid in the Docusign system for 7 days.
STATUS_CREATED
global static final String STATUS_CREATED
Created status constant.
'created'
STATUS_SENT
global static final String STATUS_SENT
Sent status constant.
'sent'
STATUS_DELIVERED
global static final String STATUS_DELIVERED
Delivered status constant.
'delivered'
STATUS_DECLINED
global static final String STATUS_DECLINED
Declined status constant.
'declined'
STATUS_VOIDED
global static final String STATUS_VOIDED
Voided status constant.
'voided'
STATUS_COMPLETED
global static final String STATUS_COMPLETED
Completed status constant.
'completed'

Methods

global Envelope( final Id id, final String name, final UUID docuSignId, final Id envelopeConfigurationId, final List<Document> documents, final List<Recipient> recipients, final List<CustomField> customFields, final Notifications notifications, final String emailSubject, final String emailMessage, final Entity source, final Datetime sent )
Description
Constructs a Docusign envelope.
Parameters
id
final Id id
The ID of the associated dfsle__Envelope__c record.
name
final String name
The name of the envelope.
docuSignId
final UUID docuSignId
The Docusign ID of the envelope.
envelopeConfigurationId
final Id envelopeConfigurationId
The ID of the configuration used to create the envelope.
documents
final List<Document> documents
A list of documents contained by the envelope.
recipients
final List<Recipient> recipients
A list of recipients who receive the envelope.
customFields
final List<CustomField> customFields
A list of envelope custom fields.
notifications
final Notifications notifications
The reminder and expiration settings for the envelope.
emailSubject
final String emailSubject
The subject of the email recipients receive.
emailMessage
final String emailMessage
The message of the email recipients receive.
source
final Entity source
The Salesforce source object for the envelope.
sent
final Datetime sent
The date and time when the envelope was sent.
global static Envelope newBulkCopy(final Recipient recipient)
Description
Creates an empty bulk copy of an envelope with the specified recipient.
Returns
A bulk envelope copy with a single recipient.
Parameters
recipient
final Recipient recipient
The new recipient for the bulk copy.
global static Envelope newBulkCopy(final List<Recipient> recipients)
Description
Creates an empty bulk copy of an envelope with the specified recipients.
Returns
A bulk envelope copy.
Parameters
recipients
final List<Recipient> recipients
The new recipients for the bulk copy.
global Envelope withCustomFields(final List<CustomField> customFields)
Description
Sets the envelope's customFields property.
Returns
This envelope with the updated customFields property.
Parameters
customFields
final List<CustomField> customFields
The new list of custom fields.
global Envelope withDocuments(final List<Document> documents)
Description
Sets the envelope's documents property.
Returns
This envelope with the updated documents property.
Parameters
documents
final List<Document> documents
The new list of documents.
global Envelope withDocuSignId(final UUID docuSignId)
Description
Sets the envelope's docuSignId property.
Returns
This envelope with the updated docuSignId property.
Parameters
docuSignId
final UUID docuSignId
The new Docusign ID of the envelope.
global Envelope withEmail(final String emailSubject, final String emailMessage)
Description
Sets the envelope's emailSubject and emailMessage properties.
Returns
This envelope with the updated emailSubject and emailMessage properties.
Parameters
emailSubject
final String emailSubject
The new email subject.
emailMessage
final String emailMessage
The new email message.
global Envelope withNotifications(final Notifications notifications)
Description
Sets the envelope's notifications property.
Returns
This envelope with the updated notifications property.
Parameters
notifications
final Notifications notifications
The new notification settings.
global Envelope withOptions(final Envelope.Options options)
Description
Sets the envelope's options property.
Returns
This envelope with the updated options property.
Parameters
options
final Envelope.Options options
The new envelope options. If null, default options will apply.
global Envelope withRecipients(final List<Recipient> recipients)
Description
Sets the envelope's recipients property.
Returns
This envelope with the updated recipients property.
Parameters
recipients
final List<Recipient> recipients
The new list of recipients.
global Envelope withSent(final Datetime sent)
Description
Sets the envelope's sent property.
Returns
This envelope with the updated sent property.
Parameters
sent
final Datetime sent
The new date and time when the envelope was sent.

Envelope.Options

global class Options
Description
Representation of Docusign envelope options.
documentWriteBack
@AuraEnabled global Document.WriteBack documentWriteBack
Document write-back options for completed envelopes.
envelopeEventUpdates
@AuraEnabled global Map<String, Map<String, Object>> envelopeEventUpdates
Map of envelope status to map of field updates. Refer to the dfsle.Envelope.STATUS_* constants for possible keys.

For data write-back to function properly:

  1. The envelope must be persisted to the database.
  2. The updates must be related to the envelope source object.
  3. The sending user must have update permissions on the target objects and fields.
For example, to update Opportunity.StageName to Closed Won when an envelope is complete:
 envelopeEventUpdates = new Map<String, Map<String, Object>> {
   dfsle.Envelope.STATUS_COMPLETED => new Map<String, Object> {
     'StageName' => 'Closed Won'
   }
 };
 
includeDefaultAutoPlaceTags
@AuraEnabled global Boolean includeDefaultAutoPlaceTags
Whether to include default anchor tabs that map to recipient roles.
recipientEventUpdates
@AuraEnabled global Map<String, Map<String, Object>> recipientEventUpdates
Map of recipient status to map of field updates. Refer to the dfsle.Recipient.STATUS_* constants for possible keys.

For data write-back to function properly:

  1. The envelope must be persisted to the database.
  2. The updates must be related to the recipient source object.
  3. The sending user must have update permissions on the target objects and fields.
For example, to update Contact.ContractDelivered__c to true when a recipient has received the envelope:
 recipientEventUpdates = new Map<String, Map<String, Object>> {
   dfsle.Recipient.STATUS_DELIVERED => new Map<String, Object> {
     'ContractDelivered__c' => true
   }
 };
 

Methods

global Options( final Boolean includeDefaultAutoPlaceTags, final Document.WriteBack documentWriteBack, final Map<String, Map<String, Object>> envelopeEventUpdates, final Map<String, Map<String, Object>> recipientEventUpdates )
Description
Constructs Docusign envelope options.
Parameters
includeDefaultAutoPlaceTags
final Boolean includeDefaultAutoPlaceTags
Whether to include default anchor tabs that map to recipient roles.
documentWriteBack
final Document.WriteBack documentWriteBack
Document write-back options for completed envelopes.
envelopeEventUpdates
final Map<String
Map of envelope status to map of field updates.
recipientEventUpdates
Map<String
Map of recipient status to map of field updates.

Envelope.Status

global class Status implements Comparable
Description
Docusign envelope status.
completed
@AuraEnabled global Datetime completed
Date and time when the envelope was completed.
docuSignId
@AuraEnabled global UUID docuSignId
The Docusign envelope ID.
emailSubject
@AuraEnabled global String emailSubject
The subject of the email message sent.
expires
@AuraEnabled global Datetime expires
Date and time when the envelope expires.
id
@AuraEnabled global Id id
The ID of the underlying dfsle__EnvelopeStatus__c record.
lastStatusUpdate
@AuraEnabled global Datetime lastStatusUpdate
Date and time when the status was last updated.
reason
@AuraEnabled global String reason
The reason the envelope was declined or voided.
recipients
@AuraEnabled global List<Recipient.Status> recipients
Associated recipient statuses.
senderEmail
@AuraEnabled global String senderEmail
The sender email address.
senderName
@AuraEnabled global String senderName
The sender name.
sent
@AuraEnabled global Datetime sent
Date and time when the envelope was sent.
source
@AuraEnabled global Entity source
The Salesforce source entity.
status
@AuraEnabled global String status
The current status.

Methods

global Status( final Id id, final Entity source, final UUID docuSignId, final String status, final String senderName, final String senderEmail, final List<Recipient.Status> recipients, final Datetime sent, final Datetime expires, final Datetime completed, final String emailSubject, final String reason, final Datetime lastStatusUpdate )
Description
Constructs a Docusign envelope status.
Parameters
id
final Id id
The ID of the underlying dfsle__EnvelopeStatus__c record.
source
final Entity source
The Salesforce source entity.
docuSignId
final UUID docuSignId
The Docusign envelope ID.
status
final String status
The current status.
senderName
final String senderName
The sender name.
senderEmail
final String senderEmail
The sender email address.
recipients
final List<Recipient.Status> recipients
Associated recipient statuses.
sent
final Datetime sent
Date and time when the envelope was sent.
expires
final Datetime expires
Date and time when the envelope expires.
completed
final Datetime completed
Date and time when the envelope was completed.
emailSubject
final String emailSubject
The subject of the email message sent.
reason
final String reason
The reason the envelope was declined or voided.
lastStatusUpdate
final Datetime lastStatusUpdate
Date and time when the status was last updated.