Send email reminders for your envelopes with the Apex Toolkit

Many of us have been in the situation where we’ve sent an envelope to a recipient for their signature and waited days or even weeks for a response. And most of us have probably also been on the other side of that scenario, where we receive an envelope, think to ourselves, “I’ll sign that later,” and then forget about it. Luckily, DocuSign has a reminders feature that addresses this problem. With this feature you can set reminders on an envelope, automatically sending email reminders to recipients at the frequency of your choice. In this blog I’ll demonstrate how to set reminders on envelopes sent through Salesforce with the Apex Toolkit.

Similar to an SDK, the Apex Toolkit exposes a full set of programmatic objects and methods that you call from your Apex code to access the DocuSign eSignature REST API. You can use it to integrate DocuSign into your Salesforce workflows and processes.

To add reminders to your envelope, you will use the Apex Toolkit’s Notifications class. The first step is to create a Notifications object that will define the notification settings for all of the envelope’s recipients. The signature for the Notifications class is as follows:

global Notifications(final Boolean remind, final Integer remindAfterDays, final Integer remindFrequencyDays, final Boolean expires, final Integer expireAfterDays, final Integer expireWarnDays, final Boolean updateChatter)

The parameters in the signature above are all required when creating a Notifications object. For more detailed descriptions of each parameter, see the Apex Toolkit reference. The Apex snippet below shows how to create an instance of the Notifications class.

dfsle.Notifications notifyRecipients = new dfsle.Notifications(
            true, // Indicates that reminders are enabled
            2, // Number of days to wait before sending a reminder
            1, // Number of days between reminders
            true, // Whether or not the envelope expires and is voided
            90, // Number of days before the envelope expires
            10, // Number of days before expiration to remind the recipient
            false // Placeholder for deprecated field
);

The above code enables notifications for an envelope and indicates that notifications should be sent after two days with one day between each notification. It also indicates that the envelope will expire in 90 days and that the recipients should be notified 10 days prior to the expiration. The final parameter is set to false to satisfy the deprecated updateChatter field.

Once you have created your Notifications object, you need to add it to the envelope. To do so, create your Envelope object and use the dfsle.Envelope.withNotifications method to add your Notification to it:

myEnvelope = myEnvelope.withNotifications(notifySigner);

Once you’ve done that, you’re ready to send your envelope as usual with the dfsle.EnvelopeService.sendEnvelope method. For more information on how to send an envelope with the Apex Toolkit, see How to send an envelope on the Developer Center.

Additional resources

Paige Rossi
Author
Paige Rossi
Sr. Programmer Writer
Published
Related Topics