hellosign / hellosign-dotnet-sdk

A .NET SDK for the HelloSign API
MIT License
26 stars 29 forks source link

Custom fields for text tags #59

Open rmedcalf opened 5 years ago

rmedcalf commented 5 years ago

I'm trying to use a text tag with a preset value

In the document I have [text-merge|req|sender|client_name|client_name]

in the C# SDK I do not see an AddCustomField method on the SignatureRequest object like I do with TemplateSignatureRequest

Instead I'm adding the fields to the CustomFields List

request.CustomFields.Add(new CustomField { Name = "client_name", Value = "My Test", ApiId = "client_name" });

However the value is not rendered in the final document

cdfulda commented 5 years ago

Any update on this? I'm running into the same issue.

Framinus commented 5 years ago

I am creating an internal ticket to get this looked at. In the meantime, here is an example workaround using the catchall AdditionalParameters.Add() method. The AdditionalParameters.Add() method allows you to add any parameter that the API supports for an endpoint. It takes two arguments - the name of the parameter (which is "custom_fields" in this case) and a value, which is equal to a stringified array of objects. Each object represents one custom field. Every custom field has two required parameters - "name" and "value", and two optional parameters: "editor" and "required." See the signature_request/send_with_template documentation for more information on how to structure custom fields.

client.AdditionalParameters.Add("custom_fields", "[{\"name\": \"Address\", \"value\": \"123 Main Street\"},{\"name\": \"Phone\", \"value\": \"555-5555\"}]");

Please see the README for more details on how to use this method.

ctyar commented 4 years ago

The SDK still has this issue but the workaround works Also, remember to remove the AdditionalParameter from the client if you re-use the client for multiple calls

client.AdditionalParameters.Remove("custom_fields");