Document
global virtual class Document implements Comparable
Description
Representation of a Docusign envelope document.
Properties
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_TEMPLATETYPE_FILEglobal static final String TYPE_FILE
Salesforce file/content version document type constant.
'ContentVersion'
TYPE_DOCUMENTWRITE_BACK_NAMEglobal 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_STATUSglobal 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_PDFglobal 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_EXTENSIONglobal 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_PDFglobal 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_EXTENSIONglobal 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_PDFglobal 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_PDFglobal 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_NONEglobal static final String SIGNER_ACKNOWLEDGEMENT_NONE
Signer has no mandated interaction with a supplemental document.
'no_interaction'
SIGNER_ACKNOWLEDGEMENT_VIEWglobal static final String SIGNER_ACKNOWLEDGEMENT_VIEW
Signer must view the supplemental document.
'view'
SIGNER_ACKNOWLEDGEMENT_ACCEPTglobal static final String SIGNER_ACKNOWLEDGEMENT_ACCEPT
Signer must accept the supplemental document.
'accept'
SIGNER_ACKNOWLEDGEMENT_VIEW_ACCEPTglobal static final String SIGNER_ACKNOWLEDGEMENT_VIEW_ACCEPT
Signer must view and accept the supplemental document.
'view_accept'
SIGNER_ACKNOWLEDGEMENT_READ_ACCEPTglobal static final String SIGNER_ACKNOWLEDGEMENT_READ_ACCEPT
Signer must view, scroll to the end, and accept the supplemental document.
'view_read_accept'
Methods
Document
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.
fromFile
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
filefinal ContentVersion file
The content version from which to construct a document.
withPdfOptions
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
pdfOptionsfinal PdfOptions pdfOptions
PDF document options.
withReplacement
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
replacementfinal Document replacement
The template replacement document. If
null, no template document will be replaced. withSupplementalOptions
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
supplementalOptionsfinal 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.
Methods
Document.Folders
global class Folders
Description
Representation of a list of Salesforce file folders and documents contained within.
Properties
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
Folders
global Folders(final List<Folder> folders, final List<Document> documents)
Description
Constructs a new list of folders and documents.
Parameters
foldersfinal 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.
Properties
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
PdfOptions
Description
Constructs PDF document options.
Parameters
transformFieldsfinal 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.
Properties
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
WriteBack
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.
Properties
includeInDownloadglobal Boolean includeInDownload
When set to
true, the document is included in the combined document download. The default value is true.signerAcknowledgementglobal 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.
dfsle.Document.SIGNER_ACKNOWLEDGEMENT_NONE.Methods
SupplementalOptions
Description
Constructs supplemental document options.
Parameters
signerAcknowledgementfinal 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.
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.