Open Documentation Menu

Using the class “DocumentEmailOptions”

The class dvelop_docs_dev.DocumentEmailOptions defines the parameters that can be used to send an e-mail with Salesforce and DMS attachments.

Signature
global with sharing class DocumentEmailOptions implements IDocumentEmailOptions
Contents
Constructors

You can create an instance of DocumentEmailOptions with the following constructors:

DocumentEmailOptions()

This constructor creates a DocumentEmailOptions instance without custom values.

Signature
global DocumentEmailOptions()
DocumentEmailOptions(subject, body, recipients)

This constructor creates an instance of DocumentEmailOptions with a subject, content and recipients.

Signature
global DocumentEmailOptions(String subject, String body, List<String> recipients)
Parameters
  • subject: The subject of the e-mail. 

    Data type: String

  • body: The text content of the e-mail. 

    Data type: String

  • recipients: A list of e-mail addresses for the recipients. 

    Data type: List<String>

Methods

The class DocumentEmailOptions provides the following methods:

setSubject(subject)

This method adds the relevant value as the subject of the e-mail.

Signature
global void setSubject(String subject)
Parameters

subject: The subject of the e-mail. 

Data type: String

setBody(body)

This method adds the relevant value as the content of the e-mail.

Signature
global void setBody(String body)
Parameters

body: The content of the e-mail. 

Data type: String

addRecipient(recipient)

This method adds another e-mail address to the existing list of recipients.

Signature
global void addRecipient(String recipient)
Parameters

recipient: The e-mail address of the new recipient. 

Data type: String

addRecipients(recipients)

This method adds multiple additional e-mail addresses to the existing list of recipients.

Signature
global void addRecipients(List<String> recipients)
Parameters

recipients: A list with the e-mail addresses of the new recipients. 

Data type: List<String>

addCcRecipient(ccRecipient)

This method adds another e-mail address to the existing list of CC recipients.

Signature
global void addCcRecipient(String ccRecipient)
Parameters

ccRecipient: The e-mail address of the new CC recipient. 

Data type: String

addCcRecipients(ccRecipients)

This method adds multiple additional e-mail addresses to the existing list of CC recipients.

Signature
global void addCcRecipients(List<String> ccRecipients)
Parameters

ccRecipients: A list with the e-mail addresses of the new CC recipients. 

Data type: List<String>

addBccRecipient(bccRecipient)

This method adds another e-mail address to the existing list of BCC recipients.

Signature
global void addBccRecipient(String bccRecipient)
Parameters

bccRecipient: The e-mail address of the new BCC recipient. 

Data type: String

addBccRecipients(bccRecipients)

This method adds multiple additional e-mail addresses to the existing list of BCC recipients.

Signature
global void addBccRecipients(List<String> bccRecipients)
Parameters

bccRecipients: A list with the e-mail addresses of the new BCC recipients. 

Data type: List<String>

addContentDocumentId(contentDocumentId)

This method adds a ContentDocument item as an e-mail attachment based on its ID.

Signature
global void addContentDocumentId(Id contentDocumentId)
Parameters

contentDocumentId: The ID of the ContentDocument item to be sent as the e-mail attachment. 

Data type: Id

addContentDocumentIds(contentDocumentIds)

This method adds multiple ContentDocument items as e-mail attachments based on their IDs.

Signature
global void addContentDocumentIds(List<Id> contentDocumentIds)
Parameters

contentDocumentIds: A list of IDs of the ContentDocument items to be sent as e-mail attachments. 

Data type: List<ID>

addDmsDocumentId(dmsDocumentId)

This method adds a DMS document as an e-mail attachment based on its ID.

Signature
global void addDmsDocumentId(String dmsDocumentId)
Parameters

dmsDocumentId: The ID of the DMS document to be sent as the e-mail attachment. 

Data type: String

addDmsDocumentIds(dmsDocumentIds)

This method adds multiple DMS documents as e-mail attachments based on their IDs.

Signature
global void addDmsDocumentIds(List<String> dmsDocumentIds)
Parameters

dmsDocumentIds: A list of IDs of the DMS documents to be sent as e-mail attachments. 

Data type: List<String>

Use

The following section shows you some application scenarios depicting the use of the class.

Sending an e-mail without attachments 

dvelop_docs_dev.DocumentEmailOptions emailOptions = new dvelop_docs_dev.DocumentEmailOptions();
emailOptions.setSubject('Urgent d.velop documents for Salesforce Update');
emailOptions.setBody('Hey, please review the release notes of the latest version of d.velop documents for Salesforce. Regards.');
emailOptions.addRecipient('astro@salesforce.com');
emailOptions.addCcRecipient('codey@salesforce.com');
emailOptions.addBccRecipient('einstein@salesforce.com');

Sending an e-mail with DMS and Salesforce attachments 

dvelop_docs_dev.DocumentEmailOptions emailOptions = new dvelop_docs_dev.DocumentEmailOptions();
emailOptions.setSubject('Urgent d.velop documents for Salesforce Update');
emailOptions.setBody('Hey, please review the release notes of the latest version of d.velop documents for Salesforce. Regards.');
emailOptions.addRecipient('astro@salesforce.com');
emailOptions.addDmsDocumentId('XH00014562');
emailOptions.addContentDocumentId('069AP0000006hn3YAA');