Question

I have read all the documentation on 3.0 API. Please don't send me there again. I can create a template on DocuSign with Custom Fields and send it out in an envelope but cannot seem to fill in custom fields (tabs?) with values from my application. Can anyone tell me the exact approach? IE: I have tried authenticate-->CreateEnvelopeFromTemplates-->SendEnvelope and just get empty form fields. I tried authenticate-->CreateEnvelope->SendEnvelope ....empty fields. I won't be able to host the file on the local file system anyway, so I think that would be a dead end even if it did work (CRM Online). here's kind of what the template is like: !https://dl.dropboxusercontent.com/u/24627933/DocuSign.PNG here's what I thought was the most promising example:

string auth = "<DocuSignCredentials><Username>" + _userName
     + "</Username><Password>" + _password
     + "</Password><IntegratorKey>" + _IntegratorKey
     + "</IntegratorKey></DocuSignCredentials>";

APIServiceSoapClient _apiClient = new APIServiceSoapClient("APIServiceSoap", _apiUrl);

/* tried this too
Tab RoutingNumber = new Tab()
{
    Name = "RoutingNumber",
    Type = TabTypeCode.Custom,
    Bold = true,
    Value = "1234 555 765"
};
Tab PayeeName = new Tab()
{
    Name = "PayeeName",
    Value = "PaiYee Na Me",
    Bold = false,
    Type = TabTypeCode.Custom
};
  */

// Construct all the recipient information
Recipient[] recipients = CreateOneSigner();
TemplateReferenceRoleAssignment[] finalRoleAssignments = new TemplateReferenceRoleAssignment[1];
finalRoleAssignments[0] = new TemplateReferenceRoleAssignment();
finalRoleAssignments[0].RoleName = recipients[0].RoleName;
finalRoleAssignments[0].RecipientID = recipients[0].ID;

// Use a server-side template -- you could make more than one of these
TemplateReference templateReference = new TemplateReference();
templateReference.TemplateLocation = TemplateLocationCode.Server;
templateReference.Template = "B3DAD8FD-1B48-4C62-9DB6-A48E5C5B40DC";
//templateReference.Template = "ABE98BE7-A400-493B-A3A3-BA489CEEA166"; 
templateReference.RoleAssignments = finalRoleAssignments;
templateReference.AdditionalTabs = new Tab[] { RoutingNumber, PayeeName };

// Construct the envelope information
EnvelopeInformation envelopeInfo = new EnvelopeInformation();
envelopeInfo.AccountId = _accountId;
envelopeInfo.Subject = "Irrevocable Commission Test";
envelopeInfo.EmailBlurb = "This is the Irrevocable Commission Disbursement Authorization form related to your Advance Pay request.";



CustomField Company = new CustomField()
{
    Name = "Company",
    Value = "Some company.",
    CustomFieldTypeSpecified = true,
    CustomFieldType = CustomFieldType.Text,
    Show = "Yes",
    Required = "Yes"
};
CustomField PayeeName = new CustomField()
{
    Name = "PayeeName",
    Value = "some name",
    CustomFieldTypeSpecified = true,
    CustomFieldType = CustomFieldType.Text,
    Show = "Yes",
    Required = "Yes"
};
CustomField RoutingNumber = new CustomField()
{
    Name = "RoutingNumber",
    Value = "my routing num",
    CustomFieldTypeSpecified = true,
    CustomFieldType = CustomFieldType.Text,
    Show = "Yes",
    Required = "Yes"
};
CustomField SendToName = new CustomField()
{
    Name = "SendToName",
    Value = "Residential Advance",
    CustomFieldTypeSpecified = true,
    CustomFieldType = CustomFieldType.Text,
    Show = "Yes",
    Required = "Yes"
};
CustomField AccountNumber = new CustomField()
{
    Name = "AccountNumber",
    Value = "my account ",
    CustomFieldTypeSpecified = true,
    CustomFieldType = CustomFieldType.Text,
    Show = "Yes",
    Required = "Yes"
};
CustomField AgentName = new CustomField()
{
    Name = "AccountNumber",
    Value = "my agent ",
    CustomFieldTypeSpecified = true,
    CustomFieldType = CustomFieldType.Text,
    Show = "Yes",
    Required = "Yes"
};
envelopeInfo.CustomFields = new CustomField[] { 
    Company, PayeeName, RoutingNumber, AccountNumber, SendToName
};

recipients[0].CustomFields = new CustomField[] {
    Company, PayeeName, RoutingNumber, AccountNumber, SendToName
};

using (var scope = new System.ServiceModel.OperationContextScope(_apiClient.InnerChannel))
{
    var httpRequestProperty = new System.ServiceModel.Channels.HttpRequestMessageProperty();
    httpRequestProperty.Headers.Add("X-DocuSign-Authentication", auth);
    System.ServiceModel.OperationContext.Current.OutgoingMessageProperties[System.ServiceModel.Channels.HttpRequestMessageProperty.Name] =
        httpRequestProperty;

    EnvelopeStatus status1 =
        _apiClient.CreateEnvelopeFromTemplates(new TemplateReference[] { templateReference },
                                                recipients,
                                                envelopeInfo,
                                                false);

    Console.WriteLine(status1);

    if (status1.Status.ToString() == "Created")
    {
        EnvelopeStatus sendStatus = _apiClient.SendEnvelope(status1.EnvelopeID, _accountId);
    }
}
Was it helpful?

Solution 2

It appears that the objects used in the C# examples and suggested above are not correct. The values now show up when I use TemplateReferenceFieldDataDataValue and add that as FieldData.DataValues.

        templateReference.RoleAssignments = finalRoleAssignments;
        var dataFieldValues = new TemplateReferenceFieldDataDataValue[3];
        dataFieldValues[0] = new TemplateReferenceFieldDataDataValue();
        dataFieldValues[0].TabLabel = "RoutingNumber";
        dataFieldValues[0].Value = "R12345678";
        dataFieldValues[1] = new TemplateReferenceFieldDataDataValue();
        dataFieldValues[1].TabLabel = "AccountNumber";
        dataFieldValues[1].Value = "A87654321";
        dataFieldValues[2] = new TemplateReferenceFieldDataDataValue();
        dataFieldValues[2].TabLabel = "Escrow";
        dataFieldValues[2].Value = "E777333";

        templateReference.FieldData = new TemplateReferenceFieldData();
        templateReference.FieldData.DataValues = dataFieldValues;

Hope that saves someone else some time.

OTHER TIPS

I believe you need to use the tabLabel property in order to populate the data field. Try using something like this:

CustomField AccountNumber = new CustomField()
    {
        TabLabel = "AccountNumber",
        Name = "AccountNumber",
        Value = "my account ",
        CustomFieldTypeSpecified = true,
        CustomFieldType = CustomFieldType.Text,
        Show = "Yes",
        Required = "Yes"
    };
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top