2017-08-28 64 views
2

我試圖根據模板創建信封並將自定義字段分配給其中一個收件人(「customFields」:[「5616999」,這是員工ID) 。Docusign:使用收件人自定義字段創建信封

這是我的POST REST API: URI:https://demo.docusign.net/restapi/v2/accounts/{accountid}/envelopes

有效載荷:

{ "status":"sent", 
"emailSubject": "Test with template and custom field", 
"templateId": "447e6671-74d1-45ce-bf3b-aa7a5c235ea5", "documents": [{ "documentId": "25407849", "name": "testTemplateDoc2.pdf", "documentBase64": " my base64 string of the document"}], 
"templateRoles": [{ 
     "email": "[email protected]", 
     "name": "john doe", 
     "recipientId": "10501840", 
     "roleName": "RH", 
     "routingOrder": "1", 
     "emailNotification": { 
      "emailBody": "text12808", 
      "emailSubject": "Signez ce document [[Collaborateur_UserName]]", 
      "supportedLanguage": "fr" 
     }, 
     "recipientSignatureProviders": [{ 
       "signatureProviderName": "universalsignaturepen_opentrust_hash_tsp", 
       "signatureProviderOptions": { 
        "sms": "+33265555555" 
       } 
      } 
     ], 
     "tabs": { 
      "signHereTabs": [{ 
        "anchorString": "/RH1/", 
        "anchorUnits": "pixels", 
        "anchorXOffset": "0", 
        "anchorYOffset": "0", 
        "name": "Please sign here", 
        "optional": "false", 
        "recipientId": "10501840", 
        "scaleValue": 1 
       } 
      ] 
     } 
    }, { 
     "email": "[email protected]", 
     "name": "jane doe", 
     "recipientId": "61432066", 
     "roleName": "Collaborateur", 
     "routingOrder": "2", 
     "emailNotification": { 
      "emailBody": "text2 2808", 
      "emailSubject": "Signez votre document Mr. [[Collaborateur_UserName]]", 
      "supportedLanguage": "fr" 
     }, 
     "recipientSignatureProviders": [{ 
       "signatureProviderName": "universalsignaturepen_opentrust_hash_tsp", 
       "signatureProviderOptions": { 
        "oneTimePassword": "1234" 
       } 
      } 
     ], 
     "tabs": { 
      "signHereTabs": [{ 
        "anchorString": "/S1/", 
        "anchorUnits": "pixels", 
        "anchorXOffset": "0", 
        "anchorYOffset": "0", 
        "name": "Please sign here", 
        "optional": "false", 
        "recipientId": "61432066", 
        "scaleValue": 1 
       } 
      ] 
     }, 
     "customFields": ["5616999"] 
    }, { 
     "email": "[email protected]", 
     "name": "john3 doe3", 
     "recipientId": "64377607", 
     "roleName": "Directeur", 
     "routingOrder": "3", 
     "emailNotification": { 
      "emailBody": "text3 2808", 
      "emailSubject": "consultez le document de Mr. [[Collaborateur_UserName]]", 
      "supportedLanguage": "fr" 
     }, 
     "recipientSignatureProviders": [{ 
       "signatureProviderName": "universalsignaturepen_opentrust_hash_tsp", 
       "signatureProviderOptions": { 
        "oneTimePassword": "1234" 
       } 
      } 
     ] 
    } 
] 
} 

,所以我得到一個200 OK,我的包絡已成功創建,但收件人的自定義字段不會出現在我在信封上做了一個簡單的GET。 我認爲這沒有考慮到。 這是我的GET URI

https://demo.docusign.net/restapi/v2/accounts/{accountID}/envelopes/{envelopeid}/recipients?include_extended=true&include_tabs=true

這就是結果:

{ 
    "signers": [ 
     { 
      "tabs": { 
       "signHereTabs": [ 
        { 
         "stampType": "signature", 
         "name": "Please sign here", 
         "tabLabel": "Sign Here", 
         "scaleValue": 1, 
         "optional": "false", 
         "documentId": "1", 
         "recipientId": "1", 
         "pageNumber": "1", 
         "xPosition": "69", 
         "yPosition": "688", 
         "anchorString": "/RH1/", 
         "anchorXOffset": "0", 
         "anchorYOffset": "0", 
         "anchorUnits": "pixels", 
         "tabId": "a3c9e24a-054c-4e39-bb85-ff602c9afd15" 
        } 
       ] 
      }, 
      "signInEachLocation": "false", 
      "creationReason": "sender", 
      "isBulkRecipient": "false", 
      "recipientSignatureProviders": [ 
       { 
        "signatureProviderName": "universalsignaturepen_opentrust_hash_tsp", 
        "signatureProviderOptions": { 
         "sms": "+330642037079" 
        } 
       } 
      ], 
      "name": "john doe", 
      "email": "[email protected]", 
      "recipientId": "1", 
      "recipientIdGuid": "77e97f08-552e-4e5b-ab0d-1802d72813cf", 
      "requireIdLookup": "false", 
      "userId": "0358b4e5-2c64-4d37-a6c2-d9f099ff5071", 
      "routingOrder": "1", 
      "note": "", 
      "roleName": "RH", 
      "status": "created", 
      "deliveryMethod": "email", 
      "templateLocked": "false", 
      "templateRequired": "false", 
      "emailNotification": { 
       "emailSubject": "[BPMED] Signez ce document [[Collaborateur_UserName]]", 
       "emailBody": "text12808", 
       "supportedLanguage": "fr" 
      }, 
      "totalTabCount": "1" 
     }, 
     { 
      "tabs": { 
       "signHereTabs": [ 
        { 
         "stampType": "signature", 
         "name": "Please sign here", 
         "tabLabel": "Sign Here", 
         "scaleValue": 1, 
         "optional": "false", 
         "documentId": "1", 
         "recipientId": "2", 
         "pageNumber": "1", 
         "xPosition": "69", 
         "yPosition": "264", 
         "anchorString": "/S1/", 
         "anchorXOffset": "0", 
         "anchorYOffset": "0", 
         "anchorUnits": "pixels", 
         "tabId": "5bf64798-f22a-4f08-9bfd-da5745c1c0a0" 
        } 
       ] 
      }, 
      "signInEachLocation": "false", 
      "creationReason": "sender", 
      "isBulkRecipient": "false", 
      "recipientSignatureProviders": [ 
       { 
        "signatureProviderName": "universalsignaturepen_opentrust_hash_tsp", 
        "signatureProviderOptions": { 
         "oneTimePassword": "1234" 
        } 
       } 
      ], 

      "name": "jane doe", 
      "email": "[email protected]", 
      "recipientId": "2", 
      "recipientIdGuid": "c3de6e46-be6a-4ccf-b939-30c0cd251849", 
      "requireIdLookup": "false", 
      "userId": "e0a726f8-a89d-4b86-99fc-153150cd4892", 
      "routingOrder": "2", 
      "note": "", 
      "roleName": "Collaborateur", 
      "status": "created", 
      "deliveryMethod": "email", 
      "templateLocked": "false", 
      "templateRequired": "false", 
      "emailNotification": { 
       "emailSubject": "[BPMED] Signez votre document Mr. [[Collaborateur_UserName]]", 
       "emailBody": "text2 2808", 
       "supportedLanguage": "fr" 
      }, 
      "totalTabCount": "2" 
     } 
    ], 
    "agents": [], 
    "editors": [], 
    "intermediaries": [], 
    "carbonCopies": [], 
    "certifiedDeliveries": [ 
     { 

      "name": "john3 doe3", 
      "email": "[email protected]", 
      "recipientId": "3", 
      "recipientIdGuid": "b9569f7c-996d-4549-88f6-1e05e9b96ea7", 
      "requireIdLookup": "false", 
      "userId": "6f0b5463-3baa-4607-bcc9-1958873c12e2", 
      "routingOrder": "3", 
      "note": "", 
      "roleName": "Directeur", 
      "status": "created", 
      "templateLocked": "false", 
      "templateRequired": "false", 
      "emailNotification": { 
       "emailSubject": " consultez le document de Mr. [[Collaborateur_UserName]]", 
       "emailBody": " text3 2808", 
       "supportedLanguage": "fr" 
      }, 
      "totalTabCount": "0" 
     } 
    ], 
    "inPersonSigners": [], 
    "recipientCount": "3" 
} 

我試圖創建草稿模式信封,然後又做了PUT請求添加自定義字段,但它也沒有工作...

PS:我已成功創建與收件人自定義字段(不基於模板)的信封並且它是可以的,並且收件人自定義字段已很好地集成在信封中。

回答

2

您可以使用DocuSign compositeTemplates並指定收件人自定義字段。這是一個例子。 templateRoles不支持指定收件人自定義字段

{ 
    "emailSubject": "Test with template and custom field", 
    "status": "sent", 
    "compositeTemplates": [ 
     { 
      "serverTemplates": [ 
       { 
        "sequence": "1", 
        "templateId": "447e6671-74d1-45ce-bf3b-aa7a5c235ea5" 
       } 
      ], 
      "inlineTemplates": [ 
       { 
        "sequence": "1", 
        "recipients": { 
         "signers": [ 
          { 
           "email": "[email protected]", 
           "name": "john doe", 
           "recipientId": "10501840", 
           "roleName": "RH", 
           "routingOrder": "1", 
           "customFields": [ "5616999" ], 
           "tabs": { }, 
           "emailNotification": { }, 
           "recipientSignatureProviders": { } 

          } 
         ] 
        } 
       } 
      ], 
      "document": { 
       "documentId": "25407849", 
       "name": "testTemplateDoc2.pdf", 
       "fileExtension": "pdf", 
       "documentBase64": "" 
      } 
     } 
    ] 
} 
+1

非常感謝!它與compositeTemplates完美配合。 但我想知道,在使用csv文件時,是否也可以爲EnvelopeBulkRecipients發送每個收件人的customField? – user8159167

+0

您可以請發表一個單獨的問題。有人應該能夠回答它。 –

+0

好吧,我會那樣做的。謝謝你的幫助。 – user8159167

相關問題