delta360 | Posts: 7

Text Tags Reading back

0 votes
Hi, The following link provides detail on how to pass tags to eSign. https://www.esignlive.com/blog/esignlive-how-to-text-tags How do you retrieve the value of the tags back once the document has been signed programmatically? Thaban

Duo_Liang | Posts: 3776

Reply to: Text Tags Reading back

0 votes
Hi Thaban, Thanks for the posting! And just to confirm with you, do you mean how to locate the fields created by text tag and grab the value of the field? If so, you can assign names for your fields by your text tag in this way:
{{Xesl[_fieldName]:roleName:fieldType[:parameter1,parameter2,...]}}    //pattern
{{esl_reCapture1:re:capture:size(150,30),offset(0,-10)}}                                 //an example where the roleName is re, the field is a capture signature field and the field name is "reCapture1"
You can get more information about text tag usage in this document site. In this way, you can grab the package object, loop through all fields and find the field with this name and get the properties you want. Hope this could help! Duo

delta360 | Posts: 7

Reply to: Text Tags Reading back

0 votes
Hi, My question is that once the user has input the values. How do I read what the value was back? If we create a field for email and the user signs the documents. I need to read what the user inputted in the field programmatically back. The documentation provides on how to create the tags field and send it to the user to input and read the document back in pdf but I need to read what values were inputted in these tags field. You mentioned grabbing the package object and looping through all fields? What property is that? Thaban

Duo_Liang | Posts: 3776

Reply to: Text Tags Reading back

0 votes
Hi Thaban, Sorry for the misunderstanding and let me put it in this way. Attachment1 is the document with text tag I was using to generate the package. Attachment2 is the screenshot when I finish the package. (Currently, there's a known issue with text tag lefting partial text after processing as shown from the attachment, will let you know when it's fixed) Attachment3 is the json result you can see after package is completed. So from what we have discussed above, you can assign the name of your field using text tag, and you will see this name in the field json.
{
                            "binding": null,
                            "validation": {
                                "required": false,
                                "maxLength": 4000,
                                "minLength": null,
                                "enum": null,
                                "errorMessage": "",
                                "errorCode": null,
                                "pattern": ""
                            },
                            "id": "reEmail1",
                            "top": 180,
                            "page": 0,
                            "data": null,
                            "extractAnchor": null,
                            "subtype": "TEXTFIELD",
                            "extract": false,
                            "width": 150,
                            "height": 30,
                            "left": 192,
                            "type": "INPUT",
                            "value": "[email protected]",
                            "name": "reEmail1"
                        }
In this case, id and name of the field are replaced by the value we set "reEmail1" and with this, it's very easy for you to locate this field and get the value of the textfield using following code:
String apiKey = "MThFWkRMNDR4Z3NYOkt1cWlLMU0xWVA4TA==";
            String apiUrl = "https://sandbox.esignlive.com/api";

            EslClient eslClient = new EslClient(apiKey, apiUrl);

            var emailValue = "";

            DocumentPackage docPack = eslClient.GetPackage(new PackageId("fE0AxLZirTtkTBwbQQc-g7q7mGg="));

            Document document = eslClient.PackageService.GetDocumentMetadata(docPack, "bd5075a410540404d2deacc8cd93a9e1648158553ac9ef05");

            foreach (var approval in document.Signatures) {
                foreach (var field in approval.Fields) {
                    if (field.Id.Equals("reEmail1")) {
                        emailValue = field.Value;
                    }
                }
            }
            Debugger.Log(1, "Debug", emailValue + "\n");
You can find the complete code in the attachment. Hope this could help! Duo

Attachments
10-10-1.png18.26 KB
10-10-2.png23.26 KB
10-10-3.png11.45 KB
delta360 | Posts: 7

Reply to: Text Tags Reading back

0 votes
Hi, Thank you for this. I think this is exactly what I was looking for. Just curious what's the difference between document.Fields vs document.Signatures.Fields? Thaban

Duo_Liang | Posts: 3776

Reply to: Text Tags Reading back

0 votes
Hi Thaban, Fields at document level is used for "Field Injection" Feature. It's to inject text contents for your pdf using pdf forms to locate the position. And after the document is uploaded to OneSpan Sign, these document level fields become part of the document and won't exist in the package JSON again that's why when you grab the document object from OneSpan Sign, the size of the document.Fields is 0; While fields at signature/approval level are signature/date/textfields/radio button these components. They will always exist in your document metadata and show up during signing ceremony. Hope this could help! Duo

delta360 | Posts: 7

Reply to: Text Tags Reading back

0 votes
Thanks for all your help

Duo_Liang | Posts: 3776

Reply to: Text Tags Reading back

0 votes
Hi there, The issue mentioned in this thread that "text tag lefting partial text after processing" is fixed in 11.20 version. And 11.20 version is already deployed to Sandbox environment. Duo

Hello! Looks like you're enjoying the discussion, but haven't signed up for an account.

When you create an account, we remember exactly what you've read, so you always come right back where you left off