简体   繁体   English

DocuSign:信封成功但状态未“已发送”

[英]DocuSign: Successful envelope but status is not "sent"

I'm using node and I make an envelope with env.status = "sent", I then hit the envelopesApi.createEnvelope with said envelope.我正在使用节点,我用 env.status =“sent”制作了一个信封,然后我用所述信封点击了 envelopesApi.createEnvelope。 The response back says its successful but the status is "created" and no email is sent for signature to the specified signer.回复说它成功但状态是“已创建”并且没有 email 被发送给指定的签名者以供签名。 What am I missing?我错过了什么? Here is the full response这是完整的回应

{

"envelopeId": "205ed07d-8094-4031-a334-7159e1bd0f34",

"status": "created",

"statusDateTime": "2023-01-05T06:19:17.9670000Z",

"uri": "/envelopes/205ed07d-8094-4031-a334-7159e1bd0f34"

}

Also note, the simple template has a signer role on it, and a signature specified, in my code I tried both adding the signer with TemplateRole.constructFromObject, and env.templateRoles = [signer1] and also removing this code (as its specified online in the UI), both just result in status created, not sent.另请注意,简单模板上有一个签名者角色,并指定了一个签名,在我的代码中我尝试使用 TemplateRole.constructFromObject 和 env.templateRoles = [signer1] 添加签名者并删除此代码(如其在线指定在用户界面中),两者都只会导致状态创建,而不是发送。

Heres all the relevant code:继承人所有相关代码:

  async sendEnvelopeFromTemplate(accessToken: string): Promise<any>{
    // Data for this method
    // args.basePath
    // args.accessToken
    // args.accountId
    const basePath = docusign_account_base_uri + '/restapi'

    let dsApiClient = new docusign.ApiClient();
    dsApiClient.setBasePath(basePath);
    dsApiClient.addDefaultHeader("Authorization", "Bearer " + accessToken);
    let envelopesApi = new docusign.EnvelopesApi(dsApiClient);

    // Step 1. Make the envelope request body
    let envelope = this.makeEnvelope();

    // Step 2. call Envelopes::create API method
    // Exceptions will be caught by the calling function
    try{
      let results = await envelopesApi.createEnvelope(docusign_api_account_id, {
        envelopeDefinition: envelope,
      });
  
      return results;
    }
    catch(e){
      console.log("ERROR")
      console.log(e)
    }

  };

  async makeEnvelope() {

    const args = {
      signerEmail: 'REDACTED',
      signerName: 'REDACTED',
      templateId: 'REDACTED'
    }
  
    // create the envelope definition
    let env = new docusign.EnvelopeDefinition();
    env.templateId = args.templateId;
  
    // Create template role elements to connect the signer and cc recipients
    // to the template
    // We're setting the parameters via the object creation
    let signer1 = docusign.TemplateRole.constructFromObject({
      email: args.signerEmail,
      name: args.signerName,
      roleName: "signer",
    });

  
    // Add the TemplateRole objects to the envelope object
    env.templateRoles = [signer1];
    env.status = "sent"; // We want the envelope to be sent
  
    return env;
  }

You need to set status to "sent" when you create the envelope.创建信封时需要status设置为“已发送”。

Otherwise (your situation), your envelope is in status "created" which is equivalent to a draft envelope.否则(您的情况),您的信封处于“已创建”状态,相当于草稿信封。

Do you have a complete template, ie does the template contain a document?您是否有完整的模板,即模板是否包含文档? An envelope cannot be sent if a) there isn's at least one document in the envelope, b) there must be at least one recipient.如果 a) 信封中至少有一份文件,b) 必须至少有一个收件人,则无法发送信封。

There could be other side issues, such as not allowing "free-form signing" (no tabs specified for the signer) and the envelope has no tabs.可能还有其他方面的问题,例如不允许“自由格式签名”(没有为签名者指定的标签)并且信封没有标签。 But I'm going to assume your account is set up as default so that isn't an issue here.但我假设您的帐户设置为默认帐户,所以这不是问题。 Also assuming you assigned a tab to the role in your template.还假设您为模板中的角色分配了一个选项卡。

Was a simple async issue, I did not await the call to makeEnvelope, I was getting a success back, but the sent status was not being set, as soon as I awaited it the problem went away.是一个简单的异步问题,我没有等待对 makeEnvelope 的调用,我获得了成功,但是没有设置发送状态,只要我等待它,问题就消失了。 Thanks for the other helpful info.感谢您提供其他有用的信息。

let envelope = this.makeEnvelope();

needed to be需要成为

let envelope = await this.makeEnvelope();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM