微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

无法使用 createEmbeddedWithTemplate 和 getSignUrl 预填充模板

如何解决无法使用 createEmbeddedWithTemplate 和 getSignUrl 预填充模板

生成HelloSign模板和签名url的Nodejs代码

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',{
            // name: '0197265f-842e-4acd-928c-fe02ff91536b',name: 'FullNameT',value: 'Watson',editor: 'Tenant'
          },{
            // name: 'd852aa44-e766-4682-93b1-8064ed4bee5a',name: 'EmailT',value: 'watson@holmesdetective.co.uk',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 中打开以供签名时,自定义字段不会预先填充上述选项中使用的客户数据。

没有任何请求失败,模板打开正常,除了空字段。

using correct custom field names

enter image description here

解决方法

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

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。