Field Values

This guide covers how to retrieve field values after they have been entered by your signer.

Once a document package (transaction in the new UI) has been completed, you can retrieve the values entered in the fields by your user.

The Code

You can get the complete sample code from the Developer Community Code Share, here.

Creating and Sending a Package with Fields

The first step is to create and send a package with text fields, for example, to an email account you have access. If you already have a completed package with text fields, you can skip to next segment. Once you have done so, go ahead and enter some sample information and sign the document to complete the package, as shown below.

Capture

If you need a comparison to the basic signature object creation or if this is your first time creating a package with the Java SDK, see this guide.

Retrieving Field Values

Next, you will need to retrieve the id of your completed package and create a PackageId object.

PackageId packageId = new PackageId( "-flBLByWAFTxTKAM54ywiOgeOnI=" );

Once you have done this, you call on your OneSpan Sign client to retrieve the field summaries of your completed package. Field summaries are returned to you as a list from OneSpan Sign. The sample code below will loop through each field summary and print out the signer id, document id, field id, and the field value.

List<FieldSummary> fieldSummaries = eslClient.getFieldValues( packageId );
		 
System.out.println( "SignerId || DocumentId || FieldId: Value\n" );

for ( FieldSummary fieldSummary : fieldSummaries ) {
          System.out.println( fieldSummary.getSignerId() + " || " + fieldSummary.getDocumentId() + " || " + 
	  fieldSummary.getFieldId() + ": " + fieldSummary.getFieldValue() );
}

Running Your Code

You can now go ahead and run your code. Below is a screenshot of the output of the code that prints the results to the console.

fieldvalues

Get the Code

Once a document package (transaction in the new UI) has been completed, you can retrieve the values entered in the fields by your user.

The Code

You can get the complete sample code from the Developer Community Code Share, here.

Creating and Sending a Package with Fields

The first step is to create and send a package with text fields, for example, to an email account you have access. If you already have a completed package with text fields, you can skip to next segment. Once you have done so, go ahead and enter some sample information and sign the document to complete the package, as shown below.

Capture

If you need a comparison to the basic signature object creation or if this is your first time creating a package with the .NET SDK, see this guide.

Retrieving Field Values

Next, you will need to retrieve the id of your completed package and create a PackageId object.

PackageId packageId = new PackageId( "-flBLByWAFTxTKAM54ywiOgeOnI=" );

Once you have done this, you call on your OneSpan Sign client to retrieve the field summaries of your completed package. Field summaries are returned to you as a list from OneSpan Sign. The sample code below will loop through each field summary and print out the signer id, document id, field id, and the field value.

List<FieldSummary> fieldSummaries = eslClient.FieldSummaryService.GetFieldSummary( packageId );
 
Console.WriteLine( "SignerId || DocumentId || FieldId: Value" );

foreach ( FieldSummary fieldSummary in fieldSummaries ) 
{
    Console.WriteLine( fieldSummary.SignerId + " || " + fieldSummary.DocumentId + " || " + 
        fieldSummary.FieldId + ": " + fieldSummary.FieldValue );
}

Running Your Code

You can now go ahead and run your code. Below is a screenshot of the output of the code that prints the results to the console.

fieldvalues

Get the Code

Once a document package (transaction in the new UI) has been completed, you can retrieve the values entered in the fields by your user.

The Code

You can get the complete sample code from the Developer Community Code Share, here.

Creating and Sending a Package with Fields

The first step is to create and send a package with text fields, for example, to an email account you have access. If you already have a completed package with text fields, you can skip to next segment. Once you have done so, go ahead and enter some sample information and sign the document to complete the package, as shown below.

Capture

If you need a comparison to the basic signature object creation or if this is your first time creating a package with the REST API, see this guide.

Retrieving Field Values

Once you have done this, make the following request:

HTTP Request
GET /api/packages/{packageId}/documents/{documentId}

HTTP Headers
Accept: application/json
Content-Type: application/json
Authorization: Basic api_key

Response Payload

{
  "status": "",
  "description": "",
  "id": "sample-contract",
  "signerVerificationToken": null,
  "signedHash": null,
  "extractionTypes": [
    "TEXT_TAGS"
  ],
  "data": {
    "ese_document_texttag_autofielddateformat": "dd/MM/yyyy 'GMT'",
    "ese_document_texttag_json_0": "[{\"height\":6,\"left\":162.95,\"name\":\"{{esl:signer1:initials:size(200,50)}}\",\"page\":0,\"pageHeight\":792,\"pageWidth\":612,\"top\":135.87,\"width\":1.88397},{\"height\":6,\"left\":72.1,\"name\":\"{{esl:signer2:initials:size(200,50)}}\",\"page\":0,\"pageHeight\":792,\"pageWidth\":612,\"top\":197.45,\"width\":1.88397}]",
    "ese_document_texttag_extract_needed": "true",
    "ese_document_texttag_handled_roles": "[\"signer2\",\"signer1\"]"
  },
  "approvals": [
    {
      "role": "signer1",
      "id": "5d98a944-1499-4e89-a91c-a90516a382fa",
      "data": null,
      "signed": "2017-11-07T20:25:13Z",
      "accepted": "2017-11-07T20:25:12Z",
      "fields": [
        {
          "binding": null,
          "validation": null,
          "id": "5d98a944-1499-4e89-a91c-a90516a382fa",
          "page": 0,
          "data": null,
          "subtype": "INITIALS",
          "height": 50,
          "width": 200,
          "left": 211,
          "top": 176,
          "extract": false,
          "extractAnchor": null,
          "value": "",
          "name": "5d98a944-1499-4e89-a91c-a90516a382fa",
          "type": "SIGNATURE"
        }
      ],
      "name": "5d98a944-1499-4e89-a91c-a90516a382fa"
    },
    {
      "role": "signer2",
      "id": "09b320a7-1ae5-4ce4-8d29-93822a10287b",
      "data": null,
      "signed": "2017-11-07T20:19:47Z",
      "accepted": "2017-11-07T20:19:46Z",
      "fields": [
        {
          "binding": null,
          "validation": null,
          "id": "09b320a7-1ae5-4ce4-8d29-93822a10287b",
          "page": 0,
          "data": null,
          "subtype": "INITIALS",
          "height": 50,
          "width": 200,
          "left": 94,
          "top": 256,
          "extract": false,
          "extractAnchor": null,
          "value": "",
          "name": "09b320a7-1ae5-4ce4-8d29-93822a10287b",
          "type": "SIGNATURE"
        }
      ],
      "name": "09b320a7-1ae5-4ce4-8d29-93822a10287b"
    }
  ],
  "pages": [
    {
      "id": "",
      "height": 1030,
      "width": 796,
      "left": 0,
      "top": 0,
      "index": 0,
      "version": 0
    }
  ],
  "external": null,
  "extract": true,
  "index": 0,
  "fields": [],
  "name": "Test Document",
  "size": 189550
}

Next, you will need to parse the response to JObject and loop through each field object and print out the signer id, document id, field id, and the field value.

Running Your Code

You can now go ahead and run your code. Below is a screenshot of the output of the code that prints the results to the console.

fieldvalues

Get the Code