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

Currently, there’re two approaches retrieving field values. One of them is to directly call below API:

HTTP Request
GET /api/packages/{packageId}/fieldSummary?documentId={documentId}

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

Response Payload

[
    {
        "signerId": "4b4714f7-3a28-45c4-9358-ef7dc8b86b20",
        "documentId": "574df947cae73f63ebfc07626e20b931e59e4cb90efadcdc",
        "fieldId": "AAoJoUVf3r8J",
        "fieldName": "",
        "fieldValue": "2019-01-18T16:39:39Z"
    },
    {
        "signerId": "4b4714f7-3a28-45c4-9358-ef7dc8b86b20",
        "documentId": "574df947cae73f63ebfc07626e20b931e59e4cb90efadcdc",
        "fieldId": "3jEcVDlEmC4E",
        "fieldName": "",
        "fieldValue": "this is a text area"
    },
    {
        "signerId": "4b4714f7-3a28-45c4-9358-ef7dc8b86b20",
        "documentId": "574df947cae73f63ebfc07626e20b931e59e4cb90efadcdc",
        "fieldId": "CGceQcEa38oN",
        "fieldName": "",
        "fieldValue": "this is a text field"
    },
    {
        "signerId": "4b4714f7-3a28-45c4-9358-ef7dc8b86b20",
        "documentId": "574df947cae73f63ebfc07626e20b931e59e4cb90efadcdc",
        "fieldId": "sYjj7qPHPP0Y",
        "fieldName": "",
        "fieldValue": "X"
    }
]

Note:
1. The query parameter “documentId” is optional, if not specified, field values for all documents will be returned.
2. For each node in response JSON, “signerId” actually refers to the Role ID. And it will keep to be “null” until signer has signed the approval.

Or alternatively, you can first retrieve the specific document’s metadata through below API, then parse the response and loop through all fields.

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

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

To notice, some of the code is an extension of the APEX SDK and can be gotten through this Code Share.

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 Apex SDK, see this guide.

Retrieving Field Values

Next, you will need to retrieve the id of your completed package and called below encapsulated function to retrieve the field summaries of your completed package.

   public List<TestFieldValues.FieldSummary> getFieldValues(String packageId)

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<TestFieldValues.FieldSummary> fieldSummarys = getFieldValues('ZkFpiKRSLubIVJFyFC3jezR-084=');
		
		for(TestFieldValues.FieldSummary fieldSummary: fieldSummarys){
			System.debug(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.
Capture

Get the Code