如何使用模板使用自定义字段

时间:2014-10-02 15:01:14

标签: xml rest templates docusignapi custom-fields

我一直在使用API​​,并且在我尝试使用自定义字段将信息传递到信封时实现了一个问题,该信封可以帮助我追踪它。 根据我的理解,它们是某种元数据,无论是否可见,创建时都与我们创建和存储的每个模板相关联(serverTemplates)。 我已经能够使用两个不同的文档创建我的模板,并且在发送信封时我使用API​​添加了自定义选项卡。 不幸的是,我无法得到的是自定义字段。 我在此之后创建了它们:https://www.docusign.co.uk/support/classic/documentation/cdse-admin-guide/account-admin/envelope-custom-fields 但我无法覆盖API的值。 这是我用过的XML调用的一部分:

body = "<envelopeDefinition xmlns=\"http://www.docusign.com/restapi\">" +
        "<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>";

有人可以提出建议吗?

由于

1 个答案:

答案 0 :(得分:1)

在复合模板表单中,您似乎必须在内联模板中定义自定义字段。使用以下请求我定义了三个字段。一个是在信封信息级别,并没有反映在DocuSign系统中。我在inlineTemplate中定义了两个。一个在帐户级别(在我的首选项中)配置而另一个不在。创建信封后,两者都显示在UI中(UI正确地尊重新建字段上的&#34; show&#34;标志)。

<envelopeDefinition xmlns="http://www.docusign.com/restapi">
  <emailSubject>DocuSign API - Signature Request on Document</emailSubject>
  <status>sent</status>
  <customFields>
    <textCustomFields>
      <textCustomField>
        <fieldId>1</fieldId>
        <name>Crazy Cool Custom Field Number 3</name>
        <required>true</required>
        <show>true</show>
        <value>67890</value>
      </textCustomField>
    </textCustomFields>
  </customFields>
  <compositeTemplates>
    <compositeTemplate>
      <serverTemplates>
        <serverTemplate>
          <sequence>1</sequence>
          <templateId>A32AA85C-EE69-4ABB-BE67-3B98A9FDC901</templateId>
        </serverTemplate>
      </serverTemplates>
      <inlineTemplates>
        <inlineTemplate>
          <customFields>
            <textCustomFields>
              <textCustomField>
                <fieldId>1</fieldId>
                <name>agreement_id</name>
                <required>true</required>
                <show>true</show>
                <value>12345</value>
              </textCustomField>
              <textCustomField>
                <fieldId>1</fieldId>
                <name>Crazy Custom Inline Field</name>
                <required>true</required>
                <show>true</show>
                <value>54321</value>
              </textCustomField>
            </textCustomFields>
          </customFields>
          <sequence>2</sequence>
          <recipients>
            <signers>
              <signer>
                <recipientId>1</recipientId>
                <email>me@u.them</email>
                <name>Bob Jones</name>
                <roleName>Signer1</roleName>
                <tabs>
                  <textTabs>
                    <text>
                      <tabLabel>NDACompany</tabLabel>
                      <value>12345</value>
                      <xPosition>100</xPosition>
                      <yPosition>100</yPosition>
                      <documentId>1</documentId>
                      <pageNumber>1</pageNumber>
                    </text>
                  </textTabs>
                </tabs>
              </signer>
            </signers>
          </recipients>
        </inlineTemplate>
      </inlineTemplates>
    </compositeTemplate>
  </compositeTemplates>
</envelopeDefinition>