【问题标题】:Unable to pre-fill template with createEmbeddedWithTemplate & getSignUrl无法使用 createEmbeddedWithTemplate 和 getSignUrl 预填充模板
【发布时间】:2021-04-11 11:17:21
【问题描述】:

Nodejs 代码生成 HelloSign 模板和签名 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);

在前端,只需使用 npm 包 hellosign-embedded 到 client.open 签名 url。

import HelloSign from 'hellosign-embedded';

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

当模板在 iFrame 中打开以供签名时,自定义字段不会预填充上述 opts 中使用的客户数据。

没有一个请求失败,模板可以正常打开,除了空字段。

【问题讨论】:

    标签: node.js hellosign-api


    【解决方案1】:

    您的自定义字段已分配给“房东”,因此它期望值来自签名者。将您的字段分配给“发件人”,API 将获取值并预填充字段。

    【讨论】:

    • 感谢您的回复。我无法将现有字段分配给发件人。此外,不能将自定义字段添加到 Sender Signer only Standard Fields。
    • 自定义字段只是分配给“发件人”而不是签名者角色的标准字段(请注意,只能预填充文本字段,因此您需要确保将它们设为这个类型)。如果由于某种原因(例如未列出该选项),您无法将现有文本字段分配给非签名者角色(“发件人”或“发送时的我”),那么您可能应该联系他们的技术支持。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-11-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-12-27
    相关资源
    最近更新 更多