Skip to content

Commit d6db473

Browse files
committed
Updating our documentGeneration.js code example to include dynamic tables
1 parent 216b08e commit d6db473

File tree

7 files changed

+627
-1064
lines changed

7 files changed

+627
-1064
lines changed

azure-pipelines.yml

+15
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,21 @@ steps:
7575
cp $(node_private_key.secureFilePath) code-examples-node-private/config/private.key
7676
displayName: 'place private.key'
7777

78+
- script: |
79+
echo "Checking for running Docker containers..."
80+
containers=$(docker ps -q)
81+
if [ ! -z "$containers" ]; then
82+
echo "Stopping running Docker containers..."
83+
docker stop $(docker ps -q)
84+
else
85+
echo "No Docker containers are running."
86+
fi
87+
displayName: "check for running containers"
88+
89+
- script: |
90+
docker system prune -a --force
91+
displayName: "cleanup docker files"
92+
7893
- task: Docker@2
7994
displayName: Build node image
8095
inputs:
35.8 KB
Binary file not shown.

lib/eSignature/controllers/eg042DocumentGeneration.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const api = API_TYPES.ESIGNATURE;
1818
const mustAuthenticate = '/ds/mustAuthenticate';
1919
const minimumBufferMin = 3;
2020
const demoDocsPath = path.resolve(__dirname, '../../../demo_documents');
21-
const docFile = 'Offer_Letter_Demo.docx';
21+
const docFile = 'Offer_Letter_Dynamic_Table.docx';
2222

2323
/**
2424
* Request a signature by email with document generation
@@ -45,6 +45,7 @@ eg042DocumentGeneration.createController = async (req, res) => {
4545
managerName: validator.escape(body.manager_name),
4646
jobTitle: validator.escape(body.job_title),
4747
salary: validator.escape(body.salary),
48+
rsus: validator.escape(body.rsus),
4849
startDate: validator.escape(body.start_date),
4950
docFile: path.resolve(demoDocsPath, docFile),
5051
};

lib/eSignature/examples/documentGeneration.js

+48-9
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ const recipientTabs = () => {
133133
});
134134

135135
const dateSigned = docusign.DateSigned.constructFromObject({
136-
anchorString: 'Date',
136+
anchorString: 'Date Signed',
137137
anchorUnits: 'pixels',
138138
anchorYOffset: '-22'
139139
});
@@ -181,9 +181,10 @@ const makeEnvelope = (templateId, args) => {
181181
*/
182182
//ds-snippet-start:eSign42Step7
183183
const formFields = (documentId, args) => {
184-
const docGenFormFieldRequest = docusign.DocGenFormFieldRequest.constructFromObject({
184+
const bonusValue = '20%';
185+
const docGenFormFieldRequest = {
185186
docGenFormFields: [
186-
docusign.DocGenFormFields.constructFromObject({
187+
{
187188
documentId: documentId,
188189
docGenFormFieldList: [
189190
docusign.DocGenFormField.constructFromObject({
@@ -198,18 +199,56 @@ const formFields = (documentId, args) => {
198199
name: 'Job_Title',
199200
value: args.jobTitle
200201
}),
201-
docusign.DocGenFormField.constructFromObject({
202-
name: 'Salary',
203-
value: args.salary
204-
}),
205202
docusign.DocGenFormField.constructFromObject({
206203
name: 'Start_Date',
207204
value: args.startDate
208205
}),
206+
docusign.DocGenFormField.constructFromObject({
207+
name: 'Compensation_Package',
208+
type: 'TableRow',
209+
rowValues: [
210+
docusign.DocGenFormFieldRowValue.constructFromObject({
211+
docGenFormFieldList: [
212+
docusign.DocGenFormField.constructFromObject({
213+
name: 'Compensation_Component',
214+
value: 'Salary'
215+
}),
216+
docusign.DocGenFormField.constructFromObject({
217+
name: 'Details',
218+
value: `$${args.salary}`
219+
})
220+
]
221+
}),
222+
docusign.DocGenFormFieldRowValue.constructFromObject({
223+
docGenFormFieldList: [
224+
docusign.DocGenFormField.constructFromObject({
225+
name: 'Compensation_Component',
226+
value: 'Bonus'
227+
}),
228+
docusign.DocGenFormField.constructFromObject({
229+
name: 'Details',
230+
value: bonusValue
231+
})
232+
]
233+
}),
234+
docusign.DocGenFormFieldRowValue.constructFromObject({
235+
docGenFormFieldList: [
236+
docusign.DocGenFormField.constructFromObject({
237+
name: 'Compensation_Component',
238+
value: 'RSUs'
239+
}),
240+
docusign.DocGenFormField.constructFromObject({
241+
name: 'Details',
242+
value: args.rsus
243+
})
244+
]
245+
})
246+
]
247+
})
209248
]
210-
})
249+
}
211250
]
212-
});
251+
};
213252

214253
return docGenFormFieldRequest;
215254
};

0 commit comments

Comments
 (0)