DocuSign Apex Toolkit: Dynamic Add Recipient (Receives a Copy)

151 Views Asked by At

I am using How to use embedded signing guide.

I would like to extend the code to add a new Recipient that will only receives a copy after the signing is completed.

I successfully updated the DocuSign Envelope Template to add Recipient (User record, Role: CC, Action: Receives a Copy).

I want to cc a specific email address based on the Case data.

I tried using this code:

new List<dfsle.Recipient> {
    dfsle.Recipient.newEmbeddedSigner(),
    dfsle.Recipient.fromSource(
        'John Smith', // Recipient name
        '[email protected]', // Recipient email
        null, //Optional phone number
        'CC', //Role Name. Specify the exact role name from template
        null)
            .withRole(dfsle.Recipient.TYPE_CARBON_COPY)
}; 

John Smith was added as Needs to Sign.

Is it possible to use Apex Toolkit to programmatically add a Recipient as Receives a Copy? Or do I need to create multiple DocuSign Envelope Templates with different Recipients for Receives a Copy?

1

There are 1 best solutions below

0
LanceDucNguyen On

My mistake, used wrong API. Should be using withType

new List<dfsle.Recipient> {
    dfsle.Recipient.newEmbeddedSigner(),
    dfsle.Recipient.fromSource(
        'John Smith', // Recipient name
        '[email protected]', // Recipient email
        null, //Optional phone number
        'CC', //Role Name. Specify the exact role name from template
        null)
            .withType(dfsle.Recipient.TYPE_CARBON_COPY)
};