AndrewM
AndrewM

Reputation: 1

CreateEnvelopeFromTemplates missing template tabs

I'm trying to utilize a DocuSign Template by providing recipient name and email address, as well as the document bytes, from my application. C# code using SOAP API:

List<DocuSignService.DocuSignWS.Recipient> RecipientList = new List<DocuSignService.DocuSignWS.Recipient>();

string templateID = string.Empty;
List<DocuSignService.DocuSignWS.TemplateReferenceRoleAssignment> roleassignlist = new List<DocuSignService.DocuSignWS.TemplateReferenceRoleAssignment>();


foreach (Element e in recipients)
{
    DocuSignService.DocuSignWS.Recipient tr = new DocuSignService.DocuSignWS.Recipient();
    tr.RoleName = Convert.ToString(e["rolename"]);
    tr.SignerName = Convert.ToString(e["name"]);
    tr.Email = Convert.ToString(e["email"]);
    tr.ID = Convert.ToString(e["id"]);
    tr.UserName = tr.SignerName;

    DocuSignService.DocuSignWS.TemplateReferenceRoleAssignment roleassign = new DocuSignService.DocuSignWS.TemplateReferenceRoleAssignment();
    roleassign.RecipientID = tr.ID;
    roleassign.RoleName = tr.RoleName;
    roleassignlist.Add(roleassign);

    RecipientList.Add(tr);
}
DocuSignService.DocuSignWS.TemplateReference templateReference = new DocuSignService.DocuSignWS.TemplateReference();
templateReference.Template = <templateID>
templateReference.Document = GetDocumentBytes();
templateReference.RoleAssignments = roleassignlist.ToArray();
DocuSignService.DocuSignWS.EnvelopeInformation envelopeInfo = new DocuSignService.DocuSignWS.EnvelopeInformation();
envelopeInfo.AccountId = credentials.dsaccountid;

client.UserName = <loginemail>
client.Password = <loginpassword>;
client.IntegratorKey = IntegratorKey;
DocuSignService.DocuSignWS.EnvelopeStatus status = client.CreateEnvelopeFromTemplates(new DocuSignService.DocuSignWS.TemplateReference[] { templateReference },
                        RecipientList.ToArray(), envelopeInfo, false);

This creates a draft envelope with my document and recipients, but the only indication that my DocuSign Template was utilized is the Email Subject Line and Email Blurb. My recipients do not have the routing order the template has for their Roles, and the resulting envelope has no Tabs at all.

I did see that others had this issue but resolved it by specifying the TemplateReferenceRoleAssignment property of TemplateReference, but I saw no change once I started doing that.

<RoleAssignments>
    <RoleAssignment>
        <RoleName>Employee</RoleName>
        <RecipientID>1</RecipientID>
    </RoleAssignment>
    <RoleAssignment>
        <RoleName>Processor</RoleName>
        <RecipientID>2</RecipientID>
    </RoleAssignment>
</RoleAssignments>
</TemplateReference>
</TemplateReferences>
<Recipients>
    <Recipient>
        <ID>1</ID>
        <UserName>signer one</UserName>
        <SignerName>signer one</SignerName>
        <Email>[email protected]</Email>
        <Type>Signer</Type>
        <AccessCode xsi:nil="true" />
        <RoleName>Employee</RoleName>
    </Recipient>
    <Recipient>
        <ID>2</ID>
        <UserName>signer two</UserName>
        <SignerName>signer two</SignerName>
        <Email>[email protected]</Email>
        <Type>Signer</Type>
        <AccessCode xsi:nil="true" />
        <RoleName>Processor</RoleName>
    </Recipient>
</Recipients>

Upvotes: 0

Views: 182

Answers (2)

AndrewM
AndrewM

Reputation: 1

It seems that all I needed was to set the Sequence on the Template Reference:

templateReference.Sequence = "1";

Upvotes: 0

Ergin
Ergin

Reputation: 9356

In addition to the recipient name and email and you to provide a valid template role name. The existing server template should have one or more roles defined which are called placeholder or template roles, and to utilize a given role you must match the roleName exactly (case-sensitive) to the role saved in the template.

Upvotes: 0

Related Questions