0

Nodejs Code to generate HelloSign template & sign url:

const opts = {
          clientId,
          test_mode: 1,
          template_id: 'template_id',
          /* title: 'embedded draft Title',
          subject: 'embedded draft sub',
          message: 'embedded draft msg', */
          signers: [
            {
              name: 'Sherlock',
              role: 'LandLord',
              email_address: 'sherlock@holmes.co.uk',
            }, {
              name: 'Watson',
              role: 'Tenant',
              email_address: 'watson@holmesdetective.co.uk'
            }
          ],
          custom_fields: [ 
            {
              // name: '6d3683a7-38bd-4e19-93e7-e56ccb38dc50',
              name: 'FullNameLL',
              value: 'Sherlock',
              required: true,
              editor: 'LandLord'
            },
            {
              // name: 'c8c2a147-0ddc-4db8-aa8f-0ed3476635e7',
              name: 'EmailLL',
              value: 'sherlock@holmes.co.uk',
              required: true,
              editor: 'LandLord'
            },
            {
            // name: '0197265f-842e-4acd-928c-fe02ff91536b',
            name: 'FullNameT',
            value: 'Watson',
            required: true,
            editor: 'Tenant'
          },
          {
            // name: 'd852aa44-e766-4682-93b1-8064ed4bee5a',
            name: 'EmailT',
            value: 'watson@holmesdetective.co.uk',
            required: true,
            editor: 'Tenant'
          }]
        };

        const rslt = await hellosign.signatureRequest.createEmbeddedWithTemplate(opts);
        const landlordSign = rslt.signature_request.signatures[0];
        const tenantSign = rslt.signature_request.signatures[1];
        console.info(rslt.signature_request);
        const signatureId = landlordSign.status_code === 'signed' ? tenantSign.signature_id : landlordSign.signature_id;
        const url = await hellosign.embedded.getSignUrl(signatureId);
      // console.info(url);
      return res.status(http_status.OK).send(url);

On FrontEnd, just using npm package hellosign-embedded to client.open sign url.

import HelloSign from 'hellosign-embedded';

      client.open(signUrl, {
        testMode: true,
        debug: true,
      });
      client.on('sign', () => {
        alert('The document has been signed!');
      });

When the template opens in an iFrame for signature, the custom fields are not pre-filled with customer data used in opts above.

None of the requests fails & the template opens fine except empty fields.using correct custom field names

enter image description here

1 Answers1

0

Your custom fields are assigned to "Landlord" and so it's expecting the value to come from the signer. Assign your fields to "Sender" instead and the API will pickup the value and pre-fill the fields.

algorozco
  • 1
  • 1
  • thanks for replying. I'm unable to assign existing fields to Sender. Also, cant add custom fields to Sender Signer only Standard Fields. – Khalil Choudhry Apr 11 '21 at 20:13
  • Custom Fields are just standard fields that are assigned to "Sender" instead of a signer role (note that only text fields can be pre-filled, so you'll need to make sure to make them of this type). If you're unable to assign your existing text fields to a non-signer role ("Sender", or "Me when sending") for some reason like not having the option listed, then you should probably reach out to their tech support. – algorozco Apr 12 '21 at 16:56