Text Tags - Word Doc field not updating
Friday, April 14, 2023 at 03:16pmWe are trying to test how well text tagging will work for us and cannot get a simple field to populate with data. I'm sure it's just a text tag/or json payload issue.
Payload:
{"status":"DRAFT","type":"PACKAGE","name":"Word Doc Test Package1","documents":[{"id":"TestWordDoc1","name":"TestWordDoc1","extract":true,"extractionTypes":["TEXT_TAGS"],"fields":[{"name":"clientId","value":"123456789"}]}],"roles":[{"id":"Signer1","name":"Signer1","type":"SIGNER","signers":[{"id":"Signer1","email":"[email protected]","firstName":"John","lastName":"Doe","title":"Chairman"}]}]}
Text Tags in a docx file are defined as:
Client ID: {{esl_clientId:Signer1:label}} <--Does not populate with data
{{esl_clientSig: Signer1:signature}}
{{esl_clientName: Signer1:SignerName}}
{{esl_clientTitle: Signer1:SignerTitle}}
{{esl_clientDate: Signer1:SigningDate}}
Client name, title and signature populate but the clientId value does not.
Reply to: Text Tags - Word Doc field not updating
Saturday, April 15, 2023 at 07:07amHi there,
Thanks for your post! The way you are setting field value "fields":[{"name":"clientId","value":"123456789"}] is so-called field injection, it only detects PDF form fields, not text tags in the PDF. In order to populate value for label fields, try to follow these steps:
(1)Create a transaction with this payload and text tags:
{"status":"DRAFT","type":"PACKAGE","name":"Word Doc Test Package1","documents":[{"id":"TestWordDoc1","name":"TestWordDoc1","extract":true,"extractionTypes":["TEXT_TAGS"]}],"roles":[{"id":"Signer1","name":"Signer1","type":"SIGNER","signers":[{"id":"Signer1","email":"[email protected]","firstName":"John","lastName":"Doe","title":"Chairman"}]}]}
Client ID: {{esl_clientId:Signer1:label}}
{{esl_clientSig: Signer1:signature}}
{{esl_clientName: Signer1:SignerName}}
{{esl_clientTitle: Signer1:SignerTitle}}
{{esl_clientDate: Signer1:SigningDate}}
(2)Retrieve the package JSON with a GET call:
GET /api/packages/{packageId}
(3)The text tag {{esl_clientId:Signer1:label}} defines the field name as "clientId", which can be used to loop through the package JSON ("documents" array > "approvals" array > "fields" array > "name") and locate the field.
(4)Find the JSON node of the lable field, set the "value" attribute and PUT back the field:
PUT /api/packages/{packageId}/documents/{documentId}/fields/{fieldId}
(5)Don't forget to send the transaction at the end:
PUT /api/packages/{packageId}
{"status":"SENT"}
Duo
Reply to: Text Tags - Word Doc field not updating
Monday, April 17, 2023 at 11:04amHi Duo. Thank you for your help. I tried your suggestion but when I got to step 4 and sent this PUT statment, I get a 404 - Not found error. I double checked and the ID values are correct:
PUT: https://sandbox.esignlive.com/api/packages/o2M1p5F13mJTfgbse7mfT0UylB8=/documents/TestWordDoc1/fields/clientId
I sent the entire JSON payload back with the new value for clientid.
Reply to: Text Tags - Word Doc field not updating
Monday, April 17, 2023 at 11:08amHi there,
Sorry that I missed a part of the API URL (/approvals/clientSig), the complete URL should look like this:
PUT: https://sandbox.esignlive.com/api/packages/o2M1p5F13mJTfgbse7mfT0UylB8=/documents/TestWordDoc1/approvals/clientSig/fields/clientId
Duo
Reply to: Text Tags - Word Doc field not updating
Monday, April 17, 2023 at 12:28pmOK, I tried that and I just get a 400 (Bad Request) response now.
Also, is it necessary to send the entire JSON payload back in order to update one field?
NOTE: I tried sending both the full JSON back (received error code 400, text file is attached with full JSON) and just the below JSON string (which got back HTTP code 200) but did not update the field
{ "status": "SENT","id":"o2M1p5F13mJTfgbse7mfT0UylB8=","documents":[{"id":"TestWordDoc1","approvals":[{"id":"clientSig","fields":[{"id":"clientId","value":"123456789"}]}]}]}
I've attached the full JSON package data I get back from OneSpan when I call GET Package on: https://sandbox.esignlive.com/api/packages/o2M1p5F13mJTfgbse7mfT0UylB8=
Reply to: Text Tags - Word Doc field not updating
Monday, April 17, 2023 at 01:17pmYou don't need to post back the entire package JSON, just need the field JSON. Are you trying to update the field with payload similar to below?
PUT: https://sandbox.esignlive.com/api/packages/o2M1p5F13mJTfgbse7mfT0UylB8=/documents/TestWordDoc1/approvals/clientSig/fields/clientId
{
"validation": {
"group": "",
"errorCode": null,
"required": false,
"maxLength": null,
"minLength": null,
"enum": null,
"disabled": false,
"minimumRequired": null,
"maximumRequired": null,
"errorMessage": "",
"pattern": ""
},
"binding": null,
"id": "clientId",
"page": 0,
"data": null,
"fontSize": null,
"extract": false,
"width": 150.0,
"height": 30.0,
"formattedValue": "",
"subtype": "LABEL",
"left": 155.0,
"top": 96.0,
"extractAnchor": null,
"type": "INPUT",
"value": "some value here",
"name": "clientId"
}
If the issue persists, can you also share the error message?
Duo
Reply to: Text Tags - Word Doc field not updating
Monday, April 17, 2023 at 01:49pmThe above JSON payload worked. Thank you Duo. I was paring down the JSON a little too much and it needed the validation property.
"validation": {
"group": "",
"errorCode": null,
"required": false,
"maxLength": null,
"minLength": null,
"enum": null,
"disabled": false,
"minimumRequired": null,
"maximumRequired": null,
"errorMessage": "",
"pattern": ""
},