Search code examples
docusignapi

DocuSign SOAP API duplicates tabs when using Composite Templates


We have a DocuSign integration in which users can create an Envelope consisting of multiple documents and each document referencing a DocuSign Template. This worked fine when we were using the CreateEnvelopeFromTemplates method and TemplateReference object.

We've since modified the integration to use CreateEnvelopeFromTemplatesAndForms and the Composite Templates as recommended by DocuSign. We've noticed that when creating an Envelope where 2 or more documents use the same Server Template that Template's anchor tags are duplicated for each instance of the Template.

We're following the pattern:

"compositeTemplates": [
3     {
4       "document": {...},
5       "serverTemplates": [{...}],
6       "inlineTemplates": [{...}]
7     },
{
4       "document": {...},
5       "serverTemplates": [{...}],
6       "inlineTemplates": [{...}]
7     }
8   ]

We are providing the 'document' field to use instead of the server template's document field, the inline template for recipient information, and the server template for signature location information. If both composite templates in the above example reference the same server template and that server template has 1 anchor tab each document has 2 anchor tabs in the same location.

How can we limit each server template instance to its own composite template in this case?


Solution

  • You stated you were using anchor tabs with your server template. So first, let's make sure the processing of anchor tabs is understood.

    When processing an envelope for tab placements, the first anchor tab will require loading all the text of the envelope documents so that a text search can be run. Each subsequent anchor tab text is searched for and the tabs placed. Notice this is done across the entire text of all documents, not on a per-document basis!

    Usually, a server template is used to visually place tabs at x/y coordinates and save the tabs as related to a signer Role, which can then be dynamically mapped to an actual signer recipient at envelope creation time. It appears you are using anchor tabs. This is normally seen when human users use a template as a collection of anchor tabs to apply manually in the DocuSign Web application. If the template is applied more than once in a single envelope, the anchor texts are being searched for repeatedly and each pass results in a duplicate tab. This is what you are seeing.

    For your particular use case, if anchors must be used because the layout and locations of tabs on each document are different, then only apply the ServerTemplate in the last CompositeTemplate in the sequence, or conversely, specify the anchors in the InlineTemplate of the last CompositeTemplate.