Docusign Send Multiple Envelope to multiple Signer

2019-09-07 00:12发布

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.

2条回答
ゆ 、 Hurt°
2楼-- · 2019-09-07 00:39

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

There are other supporting documentVisibility endpoints here.

查看更多
地球回转人心会变
3楼-- · 2019-09-07 01:01

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"
    }
   ]
}
查看更多
登录 后发表回答