MENU

Experience our brand-new Documentation Portal! Learn more...

    Retrieving Field Values
    • 16 Oct 2024
    • 7 Minutes to read
    • Dark
    • PDF

    Retrieving Field Values

    • Dark
    • PDF

    Article summary

    Java SDK.NET SDKREST APIAPEX SDK

    Java SDK

    To download the full code sample see our Code Share site.

    Once a transaction has been completed, you can retrieve the values entered in the fields by your signers.

    Creating and Sending a Transaction with Fields

    The first step is to create and send a transaction that has text fields. For more information, see Adding Fields.

    If you need a comparison to the basic object creation procedure, or if this is the first time creating a transaction, see Creating and Sending a Transaction.

    Once the transaction has been signed, you can then retrieve your field values.

    Retrieving Field Values

    To retrieve field values, retrieve the ID of your completed transaction and create a PackageId object. The following code will do this:

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

    Once you have done this, use your OneSpan Sign client to retrieve the field summaries of your completed transaction. Field summaries are returned to you as a list. 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() );
    }
    Java

    Results

    Here is an example of what you can expect to see once you have run your code.

    .NET SDK

    To download the full code sample see our Code Share site.

    Once a transaction has been completed, you can retrieve the values entered in the fields by your signers.

    Creating and Sending a Transaction with Fields

    The first step is to create and send a transaction that has text fields. For more information, see Adding Fields.

    If you need a comparison to the basic object creation procedure, or if this is the first time creating a transaction, see Creating and Sending a Transaction.

    Once the transaction has been signed, you can then retrieve your field values.

    Retrieving Field Values

    To retrieve field values, retrieve the ID of your completed transaction and create a PackageId object. The following code will do this:

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

    Once you have done this, use your OneSpan Sign client to retrieve the field summaries of your completed transaction. Field summaries are returned to you as a list. 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 );
    }
    C#

    Results

    Here is an example of what you can expect to see once you have run your code.

    REST API

    To download the full code sample see our Code Share site.

    Once a transaction has been completed, you can retrieve the values entered in the fields by your signers.

    Creating and Sending a Transaction with Fields

    The first step is to create and send a transaction that has text fields. For more information, see Adding Fields.

    If you need a comparison to the basic object creation procedure, or if this is the first time creating a transaction, see Creating and Sending a Transaction.

    Once the transaction has been signed, you can then retrieve your field values.

    Retrieving Field Values

    Currently, there are two approaches retrieving field values. One of them is to directly call the following API:

    HTTP Request

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

    HTTP Headers

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

    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"
        }
    ]
    JSON

    Note the following:

    • The query parameter documentId is optional. If not specified, field values for all documents will be returned.

    • For each node in response JSON, signerId actually refers to the Role ID. This will remain as "null" until the signer has signed.

    Alternatively, you can first retrieve the specific document's metadata using the following API, and then parse the response and loop through all fields.

    HTTP Request

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

    HTTP Headers

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

    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
    }
    JSON

    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.

    Results

    Here is an example of what you can expect to see once you have run your code.

    APEX SDK

    To download the full code sample see our Code Share site.

    Once a transaction has been completed, you can retrieve the values entered in the fields by your signers.

    Creating and Sending a Transaction with Fields

    The first step is to create and send a transaction that has text fields. For more information, see Adding Fields.

    If you need a comparison to the basic object creation procedure, or if this is the first time creating a transaction, see Creating and Sending a Transaction.

    Once the transaction has been signed, you can then retrieve your field values.

    Retrieving Field Values

    To retrieve field values, retrieve the ID of your completed transaction and use the following encapsulated function to retrieve the field summaries of your completed transaction.

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

    Once you have done this, use your OneSpan Sign client to retrieve the field summaries of your completed transaction. Field summaries are returned to you as a list. 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);
    }
    Plain text

    Results

    Here is an example of what you can expect to see once you have run your code.


    Was this article helpful?

    Changing your password will log you out immediately. Use the new password to log back in.
    First name must have atleast 2 characters. Numbers and special characters are not allowed.
    Last name must have atleast 1 characters. Numbers and special characters are not allowed.
    Enter a valid email
    Enter a valid password
    Your profile has been successfully updated.
    ESC

    Ozzy, our interactive help assistant