Reputation: 411
I'm fairly new to the world of DocuSign and I am trying to populate tabs for multiple recipients which have different documents set up in specific server templates in DocuSign. The tab names are identical across these documents.
The code below will populate the tabs in the document for recipient 1 with no issues, which makes sense as I am setting the tab's recipient value to 1. However, I can't figure out how to use these tabs to populate the document sent to recipients 2 and 3. I tried looping though the recipients in the array and setting the recipientid that way, but that just makes the tabs in the document that WAS working blank.
Type MyClassType = MyClass.GetType();
//add all the neccessary instances of the DocuSignWeb.TAB object into a dictionary
//giving each one a unique name based on the property it represents
var tabNames = new Dictionary<string, DocuSignWeb.Tab>();
foreach (PropertyInfo propertyInfoTabs in MyClassType.GetProperties())
{
string tabName = propertyInfoTabs.Name;
tabNames.Add(tabName, new DocuSignWeb.Tab());
}
//dynamically populate each tab with the relevant data
//and add each one to a list.
List<DocuSignWeb.Tab> tabs = new List<DocuSignWeb.Tab>();
foreach (PropertyInfo propertyInfo in MyClassType .GetProperties())
{
DocuSignWeb.Tab t = tabNames[propertyInfo.Name];
t.TabLabel = propertyInfo.Name;
t.Value = Convert.ToString(propertyInfo.GetValue(MyClass, null));
//document info is defined in server template
t.RecipientID = "1";
t.TemplateLocked = true;
t.Type = TabTypeCode.Custom;
t.CustomTabLocked = true;
t.CustomTabDisableAutoSize = true;
t.CustomTabWidth = 20;
tabs.Add(t);
}
inlineTemplate.Envelope.Tabs = tabs.ToArray();
If anyone has done this and can help, I'd really appreciate it.
Upvotes: 0
Views: 297
Reputation: 9356
DocuSign Tabs are always related to a given recipient (as opposed to the document itself). Therefore if you have 3 unique recipients, for example, then you would have to specify 3 completely separate tabs in your request, at a minimum, even if those tabs have the same name. And each tab would have a unique recipientId
which indicates which recipient it belongs to.
It's hard to tell what sort of request you're sending since you have posted the code as opposed to the JSON body the code generates, would be helpful if you post the raw JSON.
In any case, to keep the example short if you were sending to 2 unique recipients your request would look something like this:
{
"recipients": {
"signers": [
{
"email": "[email protected]",
"name": "Sally Doe",
"recipientId": 1,
"tabs": {
"textTabs": [
{
"tabLabel": "Data Field 1",
"value": "12345",
"xPosition": "100",
"yPosition": "100",
"documentId": "1",
"pageNumber": "1"
}
]
}
},
{
"email": "[email protected]",
"name": "Jon Doe",
"recipientId": 2,
"tabs": {
"textTabs": [
{
"tabLabel": "Data Field 1",
"value": "12345",
"xPosition": "100",
"yPosition": "100",
"documentId": "1",
"pageNumber": "1"
}
]
}
}
]
}
}
As you can see there's two separate tabs defined, each with a unique recipientId
even though they have the same name and value we are setting. To debug have a look at the request your code is sending (Note: You can enable Request Logging through your account preferences to easily see your requests) then go back into your code and make sure it's creating the request you expect.
Upvotes: 1