Docusign Send Multiple Envelope to multiple Signer with one to one Document to Signer mapping

假装没事ソ 提交于 2019-12-12 04:25:28

问题


I have been working on Salesforce to Docusign Integration. I have multiple documents with Specific signer for each document i.e. one document should be send to one specific user, not all. But I want to do this in one Rest API call to docusign! The documents are stored in Accounts attachments which are created dynamically for each user which are specific to user.

I have been trying this using CompositeTemplates, what I am doing is, adding document and Signer in each inlineTemplate, But it is sending all the documents to all the users in sequence. I don't want to show all document to all the user, they should see only document specific to them.

Below is the JSON which I am sending:

{
  "status": "Sent",
  "compositeTemplates": [
    {
      "inlineTemplates": [
        {
          "sequence": "1",
          "recipients": {
            "signers": [
              {
                "roleName": "Signer 1",
                "recipientId": "1",
                "name": "Anmol",
                "email": "test@gmail.com"
              }
            ]
          },
          "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": "test1@gmail.com"
              }
            ]
          },
          "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"
    }
  ]
}

Any doc, code or suggestions about the approach I am following for this will be very helpful.


回答1:


To do it in a single api call, specify the excludedDocuments property in the EnvelopeCreate request

excludedDocuments: Specifies the documents that are not visible to the recipient. Document Visibility must be enabled for the account and the enforceSignerVisibility property must be set to true for the envelope to use this.

Here is a sample Json for POST /v2/accounts/{accountId}/envelopes

Note: I have combined both your inline templates into a single 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": "recipientone@dsxtr.com",
                            "excludedDocuments": [ "2" ]
                        },
                        {
                            "recipientId": "2",
                            "name": "recipient two",
                            "email": "recipienttwo@dsxtr.com",
                            "excludedDocuments": [ "1" ]
                        }
                    ]
                },
                "documents": [
                    {
                        "name": "Doc 1",
                        "fileExtension": "doc",
                        "documentId": "1",
                        "documentBase64": ""
                    },
                    {
                        "name": "Doc 2",
                        "fileExtension": "doc",
                        "documentId": "2",
                        "documentBase64": ""
                    }
                ]
            }
        ],
        "compositeTemplateId": "1"
    }
   ]
}



回答2:


I believe you're looking for documentVisibility on the create envelope call.

There are other supporting documentVisibility endpoints here.



来源:https://stackoverflow.com/questions/42605713/docusign-send-multiple-envelope-to-multiple-signer-with-one-to-one-document-to-s

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!