2017-03-05 68 views
0

我一直致力於將Salesforce與Docusign集成。對於每個文檔,我有多個具有特定簽名者的文檔,即應將一個文檔發送給一個特定用戶,而不是全部。但我想在一個Rest API API中調用docusign來做到這一點!這些文檔存儲在爲每個用戶專門爲用戶動態創建的帳戶附件中。Docusign將多個信封一對一地發送給多個簽名者將文檔發送給簽名者映射

我一直在使用CompositeTemplates嘗試這個,我在做什麼,在每個inlineTemplate添加文件和簽名者,卻是將所有的文件,在序列中的所有用戶。 我不想向所有用戶顯示所有文檔,他們應該只看到特定於他們的文檔。

下面是我發送JSON:

{ 
    "status": "Sent", 
    "compositeTemplates": [ 
    { 
     "inlineTemplates": [ 
     { 
      "sequence": "1", 
      "recipients": { 
      "signers": [ 
       { 
       "roleName": "Signer 1", 
       "recipientId": "1", 
       "name": "Anmol", 
       "email": "[email protected]" 
       } 
      ] 
      }, 
      "envelope": { 
      "status": "Sent", 
      "emailSubject": "test1" 
      }, 
      "documents": [ 
      { 
       "name": "Doc 1", 
       "fileExtension": "doc", 
       "documentId": "1", 
       "documentBase64": "JVBERi0xLjQKJeLjz9MKN58HkeCg8gJEomcWGJdEFtOYYklsXV2dlT6R6Owc+FXFMNSlpckKM6M/ioTGkROkEjkxBDrgthySkvMxGpQJYapHKWwcwXtRU9GCg==" 
      } 
      ], 
      "customFields": { 
      "listCustomFields": [ 
       { 
       "value": "00128000003tPKB", 
       "show": "true", 
       "required": "false", 
       "name": "Account", 
       "fieldId": "1", 
       "configurationType": "salesforce" 
       } 
      ] 
      } 
     } 
     ], 
     "compositeTemplateId": "1" 
    }, 
    { 
     "inlineTemplates": [ 
     { 
      "sequence": "1", 
      "recipients": { 
      "signers": [ 
       { 
       "roleName": "Signer 2", 
       "recipientId": "1", 
       "name": "Anmol", 
       "email": "[email protected]" 
       } 
      ] 
      }, 
      "envelope": { 
      "status": "Sent", 
      "emailSubject": "test2" 
      }, 
      "documents": [ 
      { 
       "name": "Doc 2", 
       "fileExtension": "doc", 
       "documentId": "2", 
       "documentBase64": "JVBERi0xLjYNJeLjz9MNCjEzIDAgb2JqDTw8L0xpbmVhcmlmDQoxMTYNCiUlRU9GDQo=" 
      } 
      ], 
      "customFields": { 
      "listCustomFields": [ 
       { 
       "value": "00128000003tPKB", 
       "show": "true", 
       "required": "false", 
       "name": "Account", 
       "fieldId": "1", 
       "configurationType": "salesforce" 
       } 
      ] 
      } 
     } 
     ], 
     "compositeTemplateId": "2" 
    } 
    ] 
} 

任何文檔,約我下面這個辦法代碼或建議將是非常有益的。

回答

1

做到在一個單一的API調用,指定excludedDocuments財產在EnvelopeCreate要求

excludedDocuments:指定是不給收件人可見的文件。必須爲該帳戶啓用文檔可見性,並且必須將enforceSignerVisibility屬性設置爲true才能使用此信封。

下面是一個簡單的Json爲POST /v2/accounts/{accountId}/envelopes

注:我已經從你的內聯模板合併成一個單一 inlineTemplate。

{ 
    "status": "Sent", 
    "emailSubject": "Email Subject to all recipients", 
    "emailBlurb": "Email body to all recipients", 
    "compositeTemplates": [ 
    { 
     "inlineTemplates": [ 
      { 
       "sequence": "1", 
       "recipients": { 
        "signers": [ 
         { 
          "recipientId": "1", 
          "name": "recipient one", 
          "email": "[email protected]", 
          "excludedDocuments": [ "2" ] 
         }, 
         { 
          "recipientId": "2", 
          "name": "recipient two", 
          "email": "[email protected]", 
          "excludedDocuments": [ "1" ] 
         } 
        ] 
       }, 
       "documents": [ 
        { 
         "name": "Doc 1", 
         "fileExtension": "doc", 
         "documentId": "1", 
         "documentBase64": "" 
        }, 
        { 
         "name": "Doc 2", 
         "fileExtension": "doc", 
         "documentId": "2", 
         "documentBase64": "" 
        } 
       ] 
      } 
     ], 
     "compositeTemplateId": "1" 
    } 
    ] 
} 
+1

非常感謝!有用!魔術..... –

+0

但完成郵件發送後,所有簽署者簽署的文件!有什麼辦法可以解決這個問題嗎? –

+0

僅當所有收件人完成簽名時才認爲信封完整。完成郵件只會在所有收件人完成簽名後纔會發送。 –

0

我相信你正在尋找創建信封調用documentVisibility

還有其他支持documentVisibility端點here

+0

感謝您的迴應! –

相關問題