How to work with custom fields using a template



I've been working with the API and one issue materialized in the moment I tried to use custom fields to pass information to an envelope that can help me to track it back. From what I understood they're some sort of metadata, visible or not, that when created are associated with every template we have created and stored (serverTemplates). I've been able to create my template using two distinct documents, and I've added customize tabs using the API when sending the envelope. Unfortunately, what I cannot get is the custom fields. I've created them following this:http://ift.tt/1vcPP96 but no way I can override the value from the API. Here's part of the XML call I've used:



body = "<envelopeDefinition xmlns=\"http://ift.tt/1haqqKN\">" +
"<accountId>" + accountId + "</accountId>" +
"<status>sent</status>" +
"<emailSubject>DocuSign API Call - Signature request from template</emailSubject>" +

"<customFields>" +
"<textCustomFields>" +
"<textCustomField>" +
"<fieldId>1</fieldId>" +
"<name>agreement_id</name>" +
"<required>true</required>" +
"<show>true</show>" +
"<value>" + agreementId + "</value>" +
"</textCustomField>" +
"<textCustomField>" +
"<fieldId>2</fieldId>" +
"<name>party_name</name>" +
"<required>true</required>" +
"<show>true</show>" +
"<value>" + partyName + "</value>" +
"</textCustomField>" +
"</textCustomFields>" +
"</customFields>" +

"<compositeTemplates>" +
"<compositeTemplate>" +
"<serverTemplates>" +
"<serverTemplate>" +
"<sequence>1</sequence>" +
"<templateId>" + templateId + "</templateId>" +
"</serverTemplate>" +
"</serverTemplates>" +
"<inlineTemplates>" +
"<inlineTemplate>" +
"<sequence>2</sequence>" +
"<recipients>" +
"<signers>" +
"<signer>" +
"<email>" + email + "</email>" +
"<name>" + recipientName + "</name>" +
"<recipientId>1</recipientId>" +
"<roleName>" + roleName + "</roleName>" +


"<tabs>" +
"<textTabs>" +
"<text>" +
"<tabLabel>agreement_id</tabLabel>" +
"<value>" + agreementId + "</value>" +
"<xPosition>220</xPosition>" +
"<yPosition>348</yPosition>" +
"<documentId>2</documentId>" +
"<pageNumber>1</pageNumber>" +
"</text> " +

"<text>" +
"<tabLabel>party_name</tabLabel>" +
"<value>" + partyName + "</value>" +
"<xPosition>130</xPosition>" +
"<yPosition>142</yPosition>" +
"<documentId>2</documentId>" +
"<pageNumber>1</pageNumber>" +
"</text> " +
"</textTabs> " +
"</tabs>" +

"</signer>" +
"</signers>" +
"</recipients>" +

"</inlineTemplate>" +
"</inlineTemplates>" +
"</compositeTemplate>" +
"</compositeTemplates>" +
"</envelopeDefinition>";


Can someone advise please?


Thanks


No comments:

Post a Comment