0

After reading (here and here) and trying out composite templates, I'm not quite sure I understand how to properly use the Server Templates within the API request. The documentation mentions If supplied they are overlaid into the envelope in the order of their Sequence value so I've interpreted this as they would be merged together as one document. It seems they are merged together but it is yielding a result that I would not expect. The first one in the sequence is what is shown and you cannot see the others.

What I'd like to do is have a couple common headers that contain our different logos and combine that with whatever template I'm sending out. We cannot use the branding approach because they want it as part of the document within the template and as far as I can tell, there is no way to make that happen with branding.

Below is my (scrubbed) request. See my comments.

{
    "brandId": "{{brandId}}",
    "emailSubject": "Testing Subject",
    "status": "SENT",
    "compositeTemplates": [{
            "serverTemplates": [{ // First document
                    "sequence": "1",
                    "templateId": "{{headerTemplateId}}" //Header logo template
                }, {
                    "sequence": "2",
                    "templateId": "{{document1TemplateId}}" // Template with content
                }
            ],
            "inlineTemplates": [{
                    "sequence": "1",
                    "recipients": {
                        "signers": [{
                                "email": "test@test.com",
                                "name": "Leeroy Jenkins",
                                "roleName": "Customer",
                                "recipientId": "1"
                            }
                        ]
                    }
                }
            ]
        }, {
            "serverTemplates": [{ // Second document
                    "sequence": "2",
                    "templateId": "{{document2TemplateId}}"
                }
            ],
            "inlineTemplates": [{
                    "sequence": "2",
                    "recipients": {
                        "signers": [{
                                "email": "test@test.com",
                                "name": "Leeroy Jenkins",
                                "roleName": "Customer",
                                "recipientId": "1",
                                "tabs": {
                                    "textTabs": [{
                                            "tabLabel": "Address",
                                            "value": "123 Test Rd "
                                        }, {
                                            "tabLabel": "CityStateZip",
                                            "value": "Test/XY/12345"
                                        }
                                    ]
                                }
                            }
                        ]
                    }
                }
            ]
        }
    ]
}

csteele
  • 173
  • 2
  • 6
  • 2
    Each CompositeTemplate object can only reference one ServerTemplate at a time. Your first CompositeTemplate object has two ServerTemplate references, so one is being discarded. – Drew Jan 25 '19 at 19:27
  • @Drew why do you suspect that the documentation states you can provide 0 or more and if you do, they are overlaid? What would be the purpose of providing more than 1? – csteele Jan 25 '19 at 20:27

1 Answers1

1

As @Drew says, your immediate issue is that each individual composite template can only include zero or one server template.

Re: How to properly use the Server Templates within a composite template

Each composite template composites together different aspects of an envelope:

  • Zero or one template definitions stored on docusign.com
  • Newly defined recipients, tabs, documents, etc.

For example, composite templates can be used to create an envelope that includes document "B" instead of using the document included in a template on docusign.com.

Changing logos in documents

Unfortunately, the DocuSign compositing feature does not include a feature for combining the images from one document with another document to create a new (combined) document.

Some ideas:

  1. If only page one of the contract includes the logo, then you could have multiple versions of page one (treating each as a separate document), and combine the logoed page one with the other pages to form a complete envelope.

    Note that a document can be as short as a page. Recipients will view all of the envelope's documents together.

  2. Use a PDF library to manipulate the PDF document itself to change the logo. There are now many PDF libraries available, with APIs for many languages and operating systems.

  3. Use a SAAS PDF rendering service to combine the images with the content to obtain the final PDF. Eg, webmerge

  4. Send DocuSign the document in a non-PDF format. For example, you can send a .docx document. If you're using the Windows stack, it may be easier for your application to create a custom logo version of a Word doc than a PDF.

Community
  • 1
  • 1
Larry K
  • 47,808
  • 15
  • 87
  • 140
  • Thank you for the suggestions! I do want to clarify that the documentation mentions **zero or more** and not **zero or one** for including ServerTemplates. If it is truly supposed to be zero or one, it should be updated, but I've not found a way to let them know. Either way, it has become apparent that the composting effect is not as robust as it seems, but still useful nonetheless. – csteele Jan 28 '19 at 16:51
  • 1
    Thank you for the check @csteele. I have filed a DocuSIgn internal issue report to have the documentation updated. – Larry K Jan 28 '19 at 18:10
  • Documentation is correct - you can employ any number of server templates within the array for any particular compositeTemplate. If the composite template "document" element is not used to set the document for the composite template, then the lowest sequence template that has a document will contribute the document. The subsequent templates (both server and inline templates) will contribute other envelope components (envelope elements, recipients, tabs) in the sequence specified, with overwrite rules. All templates (both server and inline) should be sequenced within the composite template. – WTP Feb 21 '19 at 12:38