Unable to pre-fill template with createEmbeddedWithTemplate & getSignUrl

342 Views Asked by At

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: '[email protected]',
            }, {
              name: 'Watson',
              role: 'Tenant',
              email_address: '[email protected]'
            }
          ],
          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: '[email protected]',
              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: '[email protected]',
            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

There are 1 best solutions below

2
On

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.