1
votes

I am working with composite template because I need to include multiple templates in the envelope. In all templates, signing roles are same. I have following roles and signing order.

enter image description here

I also have need to provide custom email subject and body for each role, when I create envelope.

Here is my request json to create envelope using composite template. Purposefully left second composite template section empty so that its not too big.

{
    "status": "created",
    "compositeTemplates": [
        {
            "serverTemplates": [
                {
                    "sequence": "1",
                    "templateId": "de231abb-4566-4433-8c10-6fae41d5f36e"
                }
            ],
            "inlineTemplates": [
                {
                    "envelope": {
                        "customFields": {
                            "textCustomFields": [
                                {
                                    "name": "policy",
                                    "value": "12345"
                                }
                            ]
                        }
                    },
                    "sequence": "1",
                    "recipients": {
                        "carbonCopies": [
                            {
                                "recipientId": "1",
                                "email": "[email protected]",
                                "name": "Supervisor Name",
                                "roleName": "Supervisor",
                                "routingOrder": "2",
                                "emailNotification": {
                                    "supportedLanguage": "en",
                                    "emailSubject": "Custom email subject for supervisor",
                                    "emailBody": "Custom email body for supervisor"
                                }
                            },
                            {
                                "recipientId": "2",
                                "email": "[email protected]",
                                "name": "Admin Name",
                                "roleName": "Admin",
                                "routingOrder": "4",
                                "emailNotification": {
                                    "supportedLanguage": "en",
                                    "emailSubject": "Custom email subject for admin",
                                    "emailBody": "Custom email body for admin"
                                }
                            }
                        ],
                        "signers": [
                            {
                                "recipientId": "3",
                                "email": "[email protected]",
                                "name": "Data entry person Name",
                                "roleName": "DataEntry",
                                "routingOrder": "1",
                                "emailNotification": {
                                    "supportedLanguage": "en",
                                    "emailSubject": "Custom email subject for data entry person",
                                    "emailBody": "Custom email body for data entry person"
                                },
                                "tabs": {
                                    "textTabs": [
                                        {
                                            "tabLabel": "field name",
                                            "value": "field value"
                                        }
                                    ]
                                }
                            },
                            {
                                "recipientId": "4",
                                "email": "[email protected]",
                                "name": "client Name",
                                "roleName": "Client",
                                "routingOrder": "3",
                                "emailNotification": {
                                    "supportedLanguage": "en",
                                    "emailSubject": "Custom email subject for the client",
                                    "emailBody": "Custom email body for the client"
                                },
                                "tabs": {
                                    "textTabs": [
                                        {
                                            "tabLabel": "other field name",
                                            "value": "other value"
                                        },
                                        {
                                            "tabLabel": "other2 field name",
                                            "value": "other2 value"
                                        }
                                    ]
                                }
                            }
                        ]
                    }
                }
            ]
        },
        {
            "serverTemplates": [
                {
                    "sequence": "1",
                    "templateId": "de231abb-4566-4433-8c10-6fae41d5f36e"
                }
            ],
            "inlineTemplates": [
                {
                    .
                    - repeat same recipient information again
                    .
                }
            ]
        }
    ]
}

When I am preparing envelope create request json, I have to create one CompositeTemplate for each template I need to include. Within compositeTemplates[x]/inlineTemplates[0]/recipients I have specify information (name, email, roleName, routingOrder, email subject, email body and tabs if applicable) for all 4 recipients. I have to repeat same compositeTemplates[x]/inlineTemplates[0]/recipients for with in CompositeTemplate with duplicate information (name, email, roleName, routingOrder, email subject, email body) which sounds not right to me.

Question#1 - Do you know if there is any way to provide recipient at one single place instead of duplicating it under each CompositeTemplate?

My next question is about proving recipient and tab information but from different viewpoint. In Composite template under inlineTemplates I have to use EnvelopeRecipients to specify recipient and it’s tabs. In this case I need to know signing authority of each recipient/role because I need to put them under signers, corbonCopy etc. In case of envelope with single template I can easily use templateRole under EnvelopDefinition to specify recipient and their tab information just by role. I don’t need to know role’s signing authority.

Question#2 – Is there way to specify recipient information by role in CompositeTemplate without knowing signing authority like we can do with single template envelope?

1
Answered below. If it helped out, be sure to upvote and accept. Happy FridayMatthew Roknich

1 Answers

2
votes

Answer # 1

I do not believe so. If this workflow is a common occurrence, you might consider creating a third template containing the documents & tabs of the first two templates.

Then, you could simply send an envelope containing just that third template. In this case, you would only have to specify the recipient's information once.

However, we usually advise the composite templates pattern since it's far easier to customize and scale when your use case changes in the future.

Answer # 2

No. You are mixing two different DocuSign design patterns, i.e you should not mix Composite Template and TemplateRole.

Template Role is needed when you have one server template and you want to prepopulate the signer information and/or any DocuSign tab information present in the template from your application.

What you can do (which I'm sure you've realized) is to retrieve the signing authorities for the templates with a GET /template before making your POST /envelopes containing composite templates.