问题
I want to reuse a DocuSign template for multiple recipients in the same envelope. The template is rather simple; it has a few signing and date signed blocks.
The recipients will have different routing orders. From what I've seen, my API request needs to have the Routing Order and Role Name match the DocuSign template. If the role name and routing order don't match, I end up with an empty role (which has all of the signing blocks) on the envelope. I've also tried "merge roles on draft." The empty role will be merged into the second recipient, but I lose all of the template's signing blocks for that recipient.
Is there a way to use a template but modify the definition of the template recipient role? Ideally, I'd like to use the exact same template but change the routing order of that role for the second recipient. I'd like to avoid creating new templates in DocuSign since I could end up with many combinations.
I'd like to accomplish (UPDATE):
I want to use the same template two times in a single envelope. Each recipient will be assigned to an individual copy of the template. The final envelope should have two recipients, two documents, and each recipient will only have access and visibility to their document.
The issue is that the template's role defines the routing order. The routing order of "1" is applicable for the first recipient using the template, but the second recipient needs a routing order of "2." (The template's role expects a routing order of "1" in all cases, but I want that value to be a "2" for the second recipient.)
Example Template Information:
- Template Name (for example purposes): Test Template #1
- Role Name: Applicant 1
- Routing Order: 1 (if I don't define the routing order, DocuSign treats it as a "1" anyways)
Example Request:
EnvelopeDefinition envDef = new EnvelopeDefinition();
var signer1 = new Signer()
{
RecipientId = "1",
Name = "First User 1",
RoleName = "Applicant 1",
Email = "fakeemail1@email.com",
RoutingOrder = "1"
};
var signer2 = new Signer()
{
RecipientId = "2",
Name = "First User 2",
RoleName = "Applicant 1",
Email = "fakeemail2@email.com",
RoutingOrder = "2"
};
envDef.CompositeTemplates = new List<CompositeTemplate>();
var composite1 = new CompositeTemplate()
{
ServerTemplates = new List<ServerTemplate>()
{
new ServerTemplate("1", "Test Template #1 TEMPLATE_ID_GUID_HERE")
},
InlineTemplates = new List<InlineTemplate>()
{
new InlineTemplate()
{
Sequence = "1",
Recipients = new Recipients()
{
Signers = new List<Signer>()
{
signer1
}
}
}
}
};
var composite2 = new CompositeTemplate()
{
ServerTemplates = new List<ServerTemplate>()
{
new ServerTemplate("2", "Test Template #1 TEMPLATE_ID_GUID_HERE")
},
InlineTemplates = new List<InlineTemplate>()
{
new InlineTemplate()
{
Sequence = "2",
Recipients = new Recipients()
{
Signers = new List<Signer>()
{
signer2
}
}
}
}
};
envDef.CompositeTemplates.Add(composite1);
envDef.CompositeTemplates.Add(composite2);
envDef.EnforceSignerVisibility = "true";
// Code to send envelope
Note: Also, I'm using composite templates since our envelopes will likely have various combinations of templates and uploaded documents.
Thank you!
回答1:
This can be achieved by passing a query parameter - change_routing_order=true
while creating an envelope. So endpoint for creating envelope will be
https://{{EnvironmentVal}}/restapi/v2/accounts/{{AccountIdVal}}/envelopes?change_routing_order=true
and body of the request will be
Req Body:
where same templateId - 076d9062-cfc7-408b-a47f-88c4b74af62b is used with same RoleName but diff routing order and diff Signer details
{
"compositeTemplates": [
{
"inlineTemplates": [
{
"recipients": {
"signers": [
{
"email": "email+internal@gmail.com",
"name": "John Doe",
"recipientId": "1",
"roleName": "Signer1",
"routingOrder": "1"
}
]
},
"sequence": "2"
}
],
"serverTemplates": [
{
"sequence": "1",
"templateId": "076d9062-cfc7-408b-a47f-88c4b74af62b"
}
]
},
{
"inlineTemplates": [
{
"recipients": {
"signers": [
{
"email": "email+internal2@gmail.com",
"name": "John Doe2",
"recipientId": "2",
"roleName": "Signer1",
"routingOrder": "2"
}
]
},
"sequence": "2"
}
],
"serverTemplates": [
{
"sequence": "1",
"templateId": "076d9062-cfc7-408b-a47f-88c4b74af62b"
}
]
}
],
"status": "sent"
}
来源:https://stackoverflow.com/questions/54314025/redefining-recipient-role-on-template-on-an-envelope-to-envelope-basis