@@ -59,80 +59,60 @@ function makeEnvelope(args) {
5959 // args.ccName
6060 // args.status
6161
62- // document (html) has tag **signature_1**
62+ // document (html) has tag /sn1/
6363 //
6464 // The envelope has two recipients.
6565 // recipient 1 - signer
6666 // recipient 2 - cc
6767 // The envelope will be sent first to the signer.
6868 // After it is signed, a copy is sent to the cc person.
6969
70- // create the envelope definition
71- let env = new docusign . EnvelopeDefinition ( ) ;
72- env . emailSubject = "Example Signing Document" ;
73-
74- // add the document
75-
76- let htmlDefinition = new docusign . DocumentHtmlDefinition ( ) ;
77- htmlDefinition . source = getHTMLDocument ( args ) ;
78-
79- let document = new docusign . Document ( ) ;
80- document . name = "doc1.html" ; // can be different from actual file name
81- document . documentId = "1" ; // a label used to reference the doc
82- document . htmlDefinition = htmlDefinition ;
83-
84- // The order in the docs array determines the order in the envelope
85- env . documents = [ document ] ;
86-
8770 // create a signer recipient to sign the document, identified by name and email
8871 // We're setting the parameters via the object constructor
8972 let signer = docusign . Signer . constructFromObject ( {
9073 email : args . signerEmail ,
9174 name : args . signerName ,
75+ clientUserId : args . signerClientId ,
9276 recipientId : "1" ,
9377 routingOrder : "1" ,
78+ roleName : "Signer" ,
9479 } ) ;
9580 // routingOrder (lower means earlier) determines the order of deliveries
9681 // to the recipients. Parallel routing order is supported by using the
9782 // same integer as the order for two or more recipients.
9883
9984 // create a cc recipient to receive a copy of the documents, identified by name and email
10085 // We're setting the parameters via setters
101- let cc = new docusign . CarbonCopy ( ) ;
102- cc . email = args . ccEmail ;
103- cc . name = args . ccName ;
104- cc . routingOrder = "2" ;
105- cc . recipientId = "2" ;
106-
107- // Create signHere fields (also known as tabs) on the documents
108- let signHere = docusign . SignHere . constructFromObject ( {
109- stampType : "signature" ,
110- name : "SignHere" ,
111- tabLabel : "signatureTab" ,
112- scaleValue : "1" ,
113- optional : "false" ,
114- documentId : "1" ,
115- recipientId : "1" ,
116- pageNumber : "1" ,
117- xPosition : "143" ,
118- yPosition : "440"
119- } ) ;
120-
121- // Tabs are set per recipient / signer
122- let signerTabs = docusign . Tabs . constructFromObject ( {
123- signHereTabs : [ signHere ] ,
86+ let cc = new docusign . CarbonCopy . constructFromObject ( {
87+ email : args . ccEmail ,
88+ name : args . ccName ,
89+ routingOrder : "2" ,
90+ recipientId : "2" ,
12491 } ) ;
125- signer . tabs = signerTabs ;
126-
92+
12793 // Add the recipients to the envelope object
12894 let recipients = docusign . Recipients . constructFromObject ( {
12995 signers : [ signer ] ,
13096 carbonCopies : [ cc ] ,
13197 } ) ;
132- env . recipients = recipients ;
98+
99+ // add the document
133100
134- env . status = args . status ;
101+ let htmlDefinition = new docusign . DocumentHtmlDefinition ( ) ;
102+ htmlDefinition . source = getHTMLDocument ( args ) ;
103+
104+ let document = new docusign . Document ( ) ;
105+ document . name = "doc1.html" ; // can be different from actual file name
106+ document . documentId = "1" ; // a label used to reference the doc
107+ document . htmlDefinition = htmlDefinition ;
135108
109+ // create the envelope definition
110+ let env = new docusign . EnvelopeDefinition ( ) ;
111+ env . emailSubject = "Example Signing Document" ;
112+ env . documents = [ document ] ;
113+ env . recipients = recipients ;
114+ env . status = args . status ;
115+
136116 return env ;
137117}
138118
@@ -159,7 +139,10 @@ function getHTMLDocument(args) {
159139 . replace ( "{signerName}" , args . signerName )
160140 . replace ( "{signerEmail}" , args . signerEmail )
161141 . replace ( "{ccName}" , args . ccName )
162- . replace ( "{ccEmail}" , args . ccEmail ) ;
142+ . replace ( "{ccEmail}" , args . ccEmail )
143+ . replace ( "/sn1/" , "<ds-signature data-ds-role=\"Signer\"/>" )
144+ . replace ( "/l1q/" , "<input data-ds-type=\"number\"/>" )
145+ . replace ( "/l2q/" , "<input data-ds-type=\"number\"/>" ) ;
163146}
164147
165148function makeRecipientViewRequest ( args ) {
0 commit comments