0

I want to Create embedded Hello Sign signature document with Custom fields, but without using a Template. Is there any way to do it?

The case is, I have to get the signature on one dynamic system generated document. So can't use existing default template and have to use file instead of it. But On the generated document I require one field like Customer Name - Which is a text box, but pre-filled by signer name and customer change that text box value as per his choice before signing the document. I have tried all the things like using custom fields (but it is not allowing without using pre-defined template), FormFieldsPerDocument (it is providing the text box but not allowing to set value before generating the signature document), texttags, etc.

Here is my code snippets for the implementation

// Create embedded signature request
var request = new SignatureRequest();
request.Title = "Hello Sign Embedded Signature Document";
request.Message = strDocumentName;
request.AddSigner(signerEmail, signerName);
request.AddFile(pdfBytes, documentName);
request.FormFieldsPerDocument = lstFormFields;
request.Metadata.Add("custom_id", "1234");
request.Metadata.Add("custom_text", signerName);
request.UseTextTags = true;
request.TestMode = true;

CustomField objCustomerField = new CustomField();
objCustomerField.ApiId = "45";
objCustomerField.Editor = "Client";
objCustomerField.Type = "text";
objCustomerField.Value = "Raj Sharma";
objCustomerField.Required = true;
objCustomerField.X = 350;
objCustomerField.Y = 600;
request.CustomFields.Add(objCustomerField);

var response = client.CreateEmbeddedSignatureRequest(request, HelloSignAPIClientId);

I have tried all the possible ways from the API documentation but not able to reach to the proper solution. Please provide me a way if its possible to deal with this situation by any other method or draw my attention if I am making any mistake in this coding snippet.

rj angle
  • 1
  • 2

1 Answers1

1

You'll need to add the fields you want to pre-fill to the document in order to map custom field values to them.

If you're not using a template, you can add fields in 2 ways:

  1. Text tags
  2. Form fields per document

Text tags will require you add a tag on the document you're uploading to create the request prior to upload. There is a walkthrough in the HelloSign API documentation that covers this in detail.

Form fields per document allows you to add the fields 100% programmatically using a coordinate system.

Here is an example of a request sent that contains fields created via form fields:

var request = new SignatureRequest();
request.Title = "NDA with Acme Co.";
request.Subject = "The NDA we talked about";
request.Message = "Please sign this NDA and then we can discuss more. Let me know if you have any questions.";
request.AddSigner("jack@example.com", "Jack");
request.AddFile("c:\users\me\My Documents\nda.pdf").WithFields(
    //            id      type                     page    x    y    w   h   req signer
    new FormField("chk1", FormField.TypeCheckbox,     1, 140,  72,  36, 36, true,     0),
    new FormField("txt1", FormField.TypeText,         1, 140, 144, 225, 20, true,     0),
    new FormField("dat1", FormField.TypeDateSigned,   1, 140, 216, 225, 52, true,     0),
    new FormField("sig1", FormField.TypeSignature,    1, 140, 288, 225, 52, true,     0),
);
request.TestMode = true;
var response = client.SendSignatureRequest(request);
Console.WriteLine("New Signature Request ID: " + response.SignatureRequestId);

Once you've added fields to the document using one of the two options listed above, you can pre-fill those fields using the custom fields request parameter.

Something else to note about this is that the names you provide for your custom fields request parameter values will need to exactly match the names you assign to the fields on your document when you create them. Any discrepancy will result in your custom field values not mapping to their intended fields on your document.

erosiec
  • 46
  • 1