I am trying to make DocuSign bulk sending work using the C# SDK. I would like to set 2 custom fields for each copy, to later use during the event notification processing of DocuSign Connect.
I am using a template for the bulk operation, which doesn't have these custom fields, but for non-bulk sending, I was able to just add the fields to the envelope definition and it worked just fine.
Here is how I set these fields for bulk and non-bulk sending:
Non-bulk
envelopeDefinition.CustomFields = new CustomFields
{
TextCustomFields = new List<TextCustomField>
{
new TextCustomField
{
Name = "CustomField1",
Value = customField1Value
},
new TextCustomField
{
Name = "CustomField2",
Value = customField2Value
}
}
};
Bulk - I have done this for every BulkCopy.
CustomFields = new List<BulkSendingCopyCustomField>
{
new BulkSendingCopyCustomField
{
Name = "CustomField1",
Value = customField1Value
},
new BulkSendingCopyCustomField
{
Name = "CustomField2",
Value = customField2Value
}
}
This results in the following error:
Error calling CreateBulkSendRequest: {
"envelopeOrTemplateId":"c15eddc4-a4ca-495d-8d19-662b0e7194a4",
"batchId":"00000000-0000-0000-0000-000000000000",
"batchSize":"1","totalQueued":"0","queueLimit":"2000","errors":["BULK_SEND_ENVELOPE_CUSTOM_FIELD_DOES_NOT_EXIST_IN_ENVELOPE"],
"errorDetails":["Custom field CustomField1 does not exist in the envelope.","Custom field CustomField2 does not exist in the envelope."]}
Do I need to create these custom fields for this to work on bulk?
UPDATE
The process goes like this at the moment:
First I create a BulkSendList
(containing the setting of custom fields for each BulkCopy
inside of it) then pass this BulkSendList
to the CreateBulkSendRequest
along with the templateId.
var list = _bulkEnvelopesApi.CreateBulkSendList(accountId, bulkSendingList);
BulkSendResponse response = _bulkEnvelopesApi.CreateBulkSendRequest(accountId, list.ListId, new BulkSendRequest()
{
EnvelopeOrTemplateId = templateId,
});
So I am probably missing the creation of these custom fields then? Though I did not have to create them separately for non bulk envelopes. How do I create them for bulk? I see no such method for bulkEnvelopesApi. I am also using a template not a simple envelope for the list, and the documentation seems to be missing everything when it comes to templates...