Skip to navigation

Document

View as Markdown
global virtual class Document implements Comparable
Description
Representation of a Docusign envelope document.
extension
@AuraEnabled global String extension
The file extension of the document.
id
@AuraEnabled global Id id
The ID of the associated dfsle__Document__c record.
lastModified
@AuraEnabled global Datetime lastModified
Date and time when the document was last modified.
name
@AuraEnabled global String name
The name of the document.
pdfOptions
@AuraEnabled global PdfOptions pdfOptions
PDF document options.
replacement
@AuraEnabled global Document replacement
The document replacing a template document in an envelope.
sequence
@AuraEnabled global Integer sequence
The ordinal sequence of the document as it appears in an envelope.
size
@AuraEnabled global Integer size
The size of the document in bytes.
sourceId
@AuraEnabled global String sourceId
The Salesforce source record ID or the Docusign template ID.
supplementalOptions
@AuraEnabled global SupplementalOptions supplementalOptions
Supplemental document options. If this is a non-null value, the document will be treated as supplemental.
type
@AuraEnabled global String type
The type of the document.
TYPE_TEMPLATE
global static final String TYPE_TEMPLATE
Docusign template document type constant.
'Template'
TYPE_FILE
global static final String TYPE_FILE
Salesforce file/content version document type constant.
'ContentVersion'
TYPE_DOCUMENT
global static final String TYPE_DOCUMENT
Salesforce document type constant.
'Document'
WRITE_BACK_NAME
global static final String WRITE_BACK_NAME
Use document name for the completed document name. Only valid when all completed documents are written back separately.
'Name'
WRITE_BACK_NAME_ENVELOPE_STATUS
global static final String WRITE_BACK_NAME_ENVELOPE_STATUS
Use document name and envelope status for the completed document name. Only valid when all completed documents are written back separately.
'NameEnvStatus'
WRITE_BACK_NAME_PDF
global static final String WRITE_BACK_NAME_PDF
Use document name with PDF extension for the completed document name. Only valid when all completed documents are written back separately.
'NamePDF'
WRITE_BACK_NAME_PDF_REPLACE_EXTENSION
global static final String WRITE_BACK_NAME_PDF_REPLACE_EXTENSION
Use document name and replace the extension with PDF for the completed document name. Only valid when all completed documents are written back separately.
'NamePDFReplaceExt'
WRITE_BACK_NAME_ENVELOPE_STATUS_PDF
global static final String WRITE_BACK_NAME_ENVELOPE_STATUS_PDF
Use document name with envelope status and PDF extension for the completed document name. Only valid when all completed documents are written back separately.
'NameEnvStatusPDF'
WRITE_BACK_NAME_ENVELOPE_STATUS_PDF_REPLACE_EXTENSION
global static final String WRITE_BACK_NAME_ENVELOPE_STATUS_PDF_REPLACE_EXTENSION
Use document name with envelope status and replace the extension with PDF for the completed document name. Only valid when all completed documents are written back separately.
'NameEnvStatusPDFReplaceExt'
WRITE_BACK_ENVELOPE_PDF
global static final String WRITE_BACK_ENVELOPE_PDF
Use envelope name and PDF extension for the completed document name. Only valid when completed documents are combined.
'EnvelopePDF'
WRITE_BACK_ENVELOPE_STATUS_PDF
global static final String WRITE_BACK_ENVELOPE_STATUS_PDF
Use envelope name, status, and PDF extension for the completed document name. Only valid when completed documents are combined.
'EnvelopeEnvStatusPDF'
SIGNER_ACKNOWLEDGEMENT_NONE
global static final String SIGNER_ACKNOWLEDGEMENT_NONE
Signer has no mandated interaction with a supplemental document.
'no_interaction'
SIGNER_ACKNOWLEDGEMENT_VIEW
global static final String SIGNER_ACKNOWLEDGEMENT_VIEW
Signer must view the supplemental document.
'view'
SIGNER_ACKNOWLEDGEMENT_ACCEPT
global static final String SIGNER_ACKNOWLEDGEMENT_ACCEPT
Signer must accept the supplemental document.
'accept'
SIGNER_ACKNOWLEDGEMENT_VIEW_ACCEPT
global static final String SIGNER_ACKNOWLEDGEMENT_VIEW_ACCEPT
Signer must view and accept the supplemental document.
'view_accept'
SIGNER_ACKNOWLEDGEMENT_READ_ACCEPT
global static final String SIGNER_ACKNOWLEDGEMENT_READ_ACCEPT
Signer must view, scroll to the end, and accept the supplemental document.
'view_read_accept'

Methods

global Document( final Id id, final String type, final Integer sequence, final String name, final String extension, final Integer size, final Datetime lastModified, final String sourceId )
Description
Constructs a new Docusign envelope document.
Parameters
id
final Id id
The ID of the associated dfsle__Document__c record.
type
final String type
The type of the document.
sequence
final Integer sequence
The ordinal sequence of the document as it appears in an envelope.
name
final String name
The name of the document.
extension
final String extension
The file extension of the document.
size
final Integer size
The file extension of the document.
lastModified
final Datetime lastModified
Date and time when the document was created.
sourceId
final String sourceId
The Salesforce source record ID or the Docusign template ID.
global static Document fromFile(final ContentVersion file)
Description
Converts a Salesforce content version (file) into a Docusign envelope document.
Returns
The Docusign envelope document representation of the content version.
Parameters
file
final ContentVersion file
The content version from which to construct a document.
global static Document fromTemplate(final UUID docuSignId, final String name)
Description
Creates a Docusign envelope document from a Docusign template.
Returns
The newly-created Docusign envelope document.
Parameters
docuSignId
final UUID docuSignId
The Docusign template ID.
name
final String name
The Docusign template name.
global virtual Document withPdfOptions(final PdfOptions pdfOptions)
Description
Sets the Docusign envelope document pdfOptions property.

This method will throw a DocuSignException if this document is not a PDF.

Returns
The Docusign envelope document with updated pdfOptions.
Parameters
pdfOptions
final PdfOptions pdfOptions
PDF document options.
global virtual Document withReplacement(final Document replacement)
Description
Replaces a Docusign template document in an envelope. Only one document may be replaced per template.

If the parent document type is not a template or if the replacement document type is a template, a DocuSignException is thrown.

If the Docusign template has multiple documents, they will all be replaced by this document. Depending on how tabs are assigned, the API may return an TAB_REFERS_TO_MISSING_DOCUMENT error. For this reason, this method should be used only with templates containing only a single document to replace.

Returns
The template with the replacement document.
Parameters
replacement
final Document replacement
The template replacement document. If null, no template document will be replaced.
global virtual Document withSupplementalOptions(final SupplementalOptions supplementalOptions)
Description
Sets the Docusign envelope document supplementalOptions property.

This method will throw a DocuSignException if this document is a Docusign envelope template.

Returns
@return The Docusign envelope document with updated supplementalOptions.
Parameters
supplementalOptions
final SupplementalOptions supplementalOptions
Supplemental document options. If this is a non-null value, the document will be treated as supplemental.

Document.Folder

global class Folder
Description
Representation of a Salesforce file folder.
id
@AuraEnabled global Id id
The Salesforce folder ID.
name
@AuraEnabled global String name
The Salesforce folder name.

Methods

global Folder(final Id id, final String name)
Description
Constructs a folder.
Parameters
id
final Id id
The Salesforce folder ID.
name
final String name
The Salesforce folder name.

Document.Folders

global class Folders
Description
Representation of a list of Salesforce file folders and documents contained within.
documents
@AuraEnabled global List<Document> documents
The list of Docusign envelope documents contained within the folders.
folders
@AuraEnabled global List<Folder> folders
The list of Salesforce folders.

Methods

global Folders(final List<Folder> folders, final List<Document> documents)
Description
Constructs a new list of folders and documents.
Parameters
folders
final List<Folder> folders
The list of Salesforce folders.
documents
final List<Document> documents
The list of Docusign envelope documents contained within the folders.

Document.PdfOptions

global class PdfOptions
Description
PDF document options.
recipientSequence
@AuraEnabled global Integer recipientSequence
The envelope sequence of the recipient for whom to assign the transformed PDF tabs. If not a valid positive integer, the transformed tabs will be assigned to the first recipient. Ignored if transformFields is false.
transformFields
@AuraEnabled global Boolean transformFields
When set to true, PDF form field data is transformed into document tab values when the PDF form field name matches the Docusign custom tab dataLabel. The resulting PDF form data is also returned in the PDF meta data when requesting the document PDF.

Methods

global PdfOptions(final Boolean transformFields, final Integer recipientSequence)
Description
Constructs PDF document options.
Parameters
transformFields
final Boolean transformFields
When set to true, PDF form field data is transformed into document tab values when the PDF form field name matches the Docusign custom tab dataLabel. The resulting PDF form data is also returned in the PDF meta data when requesting the document PDF.
recipientSequence
final Integer recipientSequence
The envelope sequence of the recipient for whom to assign the transformed PDF tabs. If not a valid positive integer, the transformed tabs will be assigned to the first recipient. Ignored if transformFields is false.

Document.WriteBack

global class WriteBack
Description
Options related to writing back completed envelope documents.
combineDocuments
@AuraEnabled global Boolean combineDocuments
Whether to combine the documents into one PDF.
includeCertificateOfCompletion
@AuraEnabled global Boolean includeCertificateOfCompletion
Whether to include the Certificate of Completion (CoC).
linkedEntityId
@AuraEnabled global Id linkedEntityId
Where to link the completed envelope documents. Defaults to the envelope source ID.
nameFormat
@AuraEnabled global String nameFormat
The naming format for the completed envelope documents.

Methods

global WriteBack( final Id linkedEntityId, final String nameFormat, final Boolean combineDocuments, final Boolean includeCertificateOfCompletion )
Description
Constructs document write-back options.
Parameters
linkedEntityId
final Id linkedEntityId
Where to link the completed envelope documents. Defaults to the envelope source ID.
nameFormat
final String nameFormat
The naming format for the completed envelope documents. Refer to the dfsle.Document.WRITE_BACK_* constants for supported options.
combineDocuments
final Boolean combineDocuments
Whether to combine the documents into one PDF.
includeCertificateOfCompletion
final Boolean includeCertificateOfCompletion
Whether to include the Certificate of Completion (CoC).

Document.SupplementalOptions

global class SupplementalOptions
Description
Supplemental document options.
includeInDownload
global Boolean includeInDownload
When set to true, the document is included in the combined document download. The default value is true.
signerAcknowledgement
global String signerAcknowledgement
Sets how the signer interacts with the supplemental document. Supported constants:
  • dfsle.Document.SIGNER_ACKNOWLEDGEMENT_NONE: Signer has no mandated interaction with a supplemental document.
  • dfsle.Document.SIGNER_ACKNOWLEDGEMENT_VIEW: Signer must view the supplemental document.
  • dfsle.Document.SIGNER_ACKNOWLEDGEMENT_ACCEPT: Signer must accept the supplemental document.
  • dfsle.Document.SIGNER_ACKNOWLEDGEMENT_VIEW_ACCEPT: Signer must view and accept the supplemental document.
  • dfsle.Document.SIGNER_ACKNOWLEDGEMENT_VIEW_READ_ACCEPT: Signer must view, read, and accept the supplemental document.
The default value is dfsle.Document.SIGNER_ACKNOWLEDGEMENT_NONE.

Methods

global SupplementalOptions(final String signerAcknowledgement, final Boolean includeInDownload)
Description
Constructs supplemental document options.
Parameters
signerAcknowledgement
final String signerAcknowledgement
Sets how the signer interacts with the supplemental document. Supported constants:
  • dfsle.Document.SIGNER_ACKNOWLEDGEMENT_NONE: Signer has no mandated interaction with a supplemental document.
  • dfsle.Document.SIGNER_ACKNOWLEDGEMENT_VIEW: Signer must view the supplemental document.
  • dfsle.Document.SIGNER_ACKNOWLEDGEMENT_ACCEPT: Signer must accept the supplemental document.
  • dfsle.Document.SIGNER_ACKNOWLEDGEMENT_VIEW_ACCEPT: Signer must view and accept the supplemental document.
  • dfsle.Document.SIGNER_ACKNOWLEDGEMENT_VIEW_READ_ACCEPT: Signer must view, read, and accept the supplemental document.
The default value is dfsle.Document.SIGNER_ACKNOWLEDGEMENT_NONE.
includeInDownload
final Boolean includeInDownload
When set to true, the document is included in the combined document download. The default value is true.