How to use the docusign-esign.EnvelopeDefinition function in docusign-esign

To help you get started, we’ve selected a few docusign-esign examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github docusign / docusign-node-client / test / Recipes / CoreRecipes.js View on Github external
console.log('Error: ' + error);
      return;
    }

    if (loginInfo) {
      // list of user account(s)
      // note that a given user may be a member of multiple accounts
      var loginAccounts = loginInfo.getLoginAccounts();
      console.log('LoginInformation: ' + JSON.stringify(loginAccounts));

      // ===============================================================================
      // Step 2:  Create Envelope API (AKA Signature Request) from a Template
      // ===============================================================================

      // create a new envelope object that we will manage the signature request through
      var envDef = new docusign.EnvelopeDefinition();
      envDef.setEmailSubject('Please sign this document sent from Node SDK)');
      envDef.setTemplateId(templateId);

      // create a template role with a valid templateId and roleName and assign signer info
      var tRole = new docusign.TemplateRole();
      tRole.setRoleName(templateRoleName);
      tRole.setName(signerName);
      tRole.setEmail(signerEmail);

      // create a list of template roles and add our newly created role
      var templateRolesList = [];
      templateRolesList.push(tRole);

      // assign template role(s) to the envelope
      envDef.setTemplateRoles(templateRolesList);
github docusign / docusign-node-client / test / Recipes / CoreRecipes.js View on Github external
// Step 2:  Create Envelope API (AKA Signature Request)
      // ===============================================================================

      // create a byte array that will hold our document bytes
      var fileBytes = null;
      try {
        var fs = require('fs');
        var path = require('path');
        // read file from a local directory
        fileBytes = fs.readFileSync(path.resolve(__dirname, SignTest1File));
      } catch (ex) {
        console.log('Exception: ' + ex);
      }

      // create an envelope that will store the document(s), field(s), and recipient(s)
      var envDef = new docusign.EnvelopeDefinition();
      envDef.setEmailSubject('Please sign this document sent from Node SDK)');

      // add a document to the envelope
      var doc = new docusign.Document();
      var base64Doc = Buffer.from(fileBytes).toString('base64');
      doc.setDocumentBase64(base64Doc);
      doc.setName('TestFile.pdf'); // can be different from actual file name
      doc.setDocumentId('1');

      var docs = [];
      docs.push(doc);
      envDef.setDocuments(docs);

      // add a recipient to sign the document, identified by name and email we used above
      var signer = new docusign.Signer();
      signer.setEmail(signerEmail);