Bikram | Posts: 33

Text Field

0 votes

I am trying to update the text field inside a document in my draft package via post and/or put api for updating the specified document. The response is coming 200 on sanbox but wheneve I tried to change the value of the text field, it is not changing at all. 

 

How can we populate the value from database and use it in the text field area ? Our main requirement is to fetch the data from database and use this value to prepopulate in the text field section ? I have tried these two endpoint but it is not working. 

PUT /api/packages/{packageId}/documents/{documentId} => Retrieves a specified document 
POST /api/packages/{packageId}/documents/{documentId} = Updates a single document .

 

Can you please help me on this, this is our main priority right now. 

 


Approved Answer
Duo_Liang | Posts: 3776

Reply to: Text Field

1 votes

Sure.

For example, this is what I received from GET call:

GET /api/packages/TiDVASU-4q-jlLkd87k07Au22ak=/documents/c181fb64375ccca3f60d49096b32f6e2d88b0bde2fa89fbb/approvals/oMvxUQ5AZx0A

{

    "fromFile": false,

    "fromFileData": null,

    "role": "dce42eb8-1bcc-4b02-84a6-2eef60a0c0ec",

    "id": "oMvxUQ5AZx0A",

    "disabled": false,

    "optional": false,

    "data": null,

    "accepted": null,

    "signed": null,

    "enforceCaptureSignature": false,

    "fields": [

        {

            "binding": null,

            "validation": {

                "group": "",

                "required": false,

                "maxLength": null,

                "disabled": false,

                "minLength": null,

                "errorMessage": "",

                "enum": null,

                "minimumRequired": null,

                "maximumRequired": null,

                "errorCode": null,

                "pattern": ""

            },

            "page": 0,

            "id": "xqqO6uRmJFMA",

            "subtype": "CUSTOMFIELD",

            "extractAnchor": null,

            "formattedValue": "",

            "fontSize": null,

            "width": 165.0,

            "height": 37.0,

            "top": 842.0,

            "data": null,

            "left": 315.0,

            "extract": false,

            "type": "INPUT",

            "value": null,

            "name": "driverlicense"

        },

        {

            "binding": null,

            "validation": null,

            "page": 0,

            "id": "4oyxuDfBQ84R",

            "subtype": "FULLNAME",

            "extractAnchor": null,

            "formattedValue": "",

            "fontSize": null,

            "width": 165.0,

            "height": 37.0,

            "top": 795.0,

            "data": null,

            "left": 315.0,

            "extract": false,

            "type": "SIGNATURE",

            "value": "",

            "name": ""

        }

    ],

    "name": ""

}

 

And this is what to send back via PUT call:
PUT /api/packages/TiDVASU-4q-jlLkd87k07Au22ak=/documents/c181fb64375ccca3f60d49096b32f6e2d88b0bde2fa89fbb/approvals/oMvxUQ5AZx0A

{

    "fromFile": false,

    "fromFileData": null,

    "role": "dce42eb8-1bcc-4b02-84a6-2eef60a0c0ec",

    "id": "oMvxUQ5AZx0A",

    "disabled": false,

    "optional": false,

    "data": null,

    "accepted": null,

    "signed": null,

    "enforceCaptureSignature": false,

    "fields": [

        {

            "binding": null,

            "validation": {

                "group": "",

                "required": false,

                "maxLength": null,

                "disabled": false,

                "minLength": null,

                "errorMessage": "",

                "enum": null,

                "minimumRequired": null,

                "maximumRequired": null,

                "errorCode": null,

                "pattern": ""

            },

            "page": 0,

            "id": "xqqO6uRmJFMA",

            "subtype": "LABEL",

            "extractAnchor": null,

            "formattedValue": "",

            "fontSize": null,

            "width": 165.0,

            "height": 37.0,

            "top": 842.0,

            "data": null,

            "left": 315.0,

            "extract": false,

            "type": "INPUT",

            "value": "some data here",

            "name": "driverlicense"

        },

        {

            "binding": null,

            "validation": null,

            "page": 0,

            "id": "4oyxuDfBQ84R",

            "subtype": "FULLNAME",

            "extractAnchor": null,

            "formattedValue": "",

            "fontSize": null,

            "width": 165.0,

            "height": 37.0,

            "top": 795.0,

            "data": null,

            "left": 315.0,

            "extract": false,

            "type": "SIGNATURE",

            "value": "",

            "name": ""

        }

    ],

    "name": ""

}

 

Duo


Bikram | Posts: 33

Reply to: Text Field

0 votes

Also ,we are looking to prepopulate the custom field with the database from our system after the auction finishes. My question is whenever we prepopulate the data to the custom field and send it to the transaction. the default value of the custom field will change and the other agent when draging and dropping the custom field, they will see the previous value. 

What we want is everytime the custom field is draged and dropped, it should have no value at all so that the value is taken from the database and send it to sign. Is this possible, please let us know. 


Duo_Liang | Posts: 3776

Reply to: Text Field

0 votes

Hi Bikram,

 

Thanks for your post! For your two questions:
#1. Update text field value

Instead of updating the document level resource, you can call this API endpoint:
PUT /api/packages/{packageId}/documents/{documentId}/approvals/{approvalId}

This API allows to update all the field values under this approval/signature in bulk. In real practice, you can invoke a GET call first, loop through the response and modify the field values by their IDs or names, and send back a PUT call.

 

#2. Prepopulate Custom Field

Custom Fields offers you the ability to add supplementary information to your sender profiles in addition to the out-of-the-box fields like “title”, “company”, e.g. contact address, phone number, employee ID, etc. Considering it's a sender based feature, every time you changed the value will update the sender profile (GET /api/account/senders/{senderId}), that's why you mentioned "they will see the previous value".

If you are looking for a field which value will be different per transaction, one workaround is to have sender manually add a text field with certain field name and update its value together with what we discussed in #1.

 

Duo


Bikram | Posts: 33

Reply to: Text Field

0 votes

Hello Duo, 

 

Thanks for your reply. We will have a lot of agents as a sender and we want them to use the custom field for their convenience., our business requirement is have a empty custom field everytime agent drags and drops and then prepopulate this value from database and send to sign. Yes, I have found that the text field can be modified by their id's or name but for this the agent have to manually type field name everytime, this is not what we want. 

 

We are looking for a solution where, the custom field value is empty and it gets updated through database value for that transaction and in the same time if another agent uses the system, they should be able to use the custom field with empty value. How can this be achieved through onespan api ? Is there a way to duplicate the same custom field so that the old value won't come when dragging and dropping. 

We are in the mid way of implementing onespan in our system, please help us to find a solution for this scenario. 

Thanks


Duo_Liang | Posts: 3776

Reply to: Text Field

0 votes

Hi Bikram,

 

How about this workaround:

#1 From sender profile, set the custom field value as empty string or masked value (e.g. xx-xx-xxxx)

#2 Your agent will still use the custom field to design the document layout

#3 At the point when your application reads database and inject field values, we've discussed about the solution about invoking the GET call first then make the PUT call. When modifying the GET call response and build the payload:

(1)filter the custom field by its field name

(2)change the field subtype from "CUSTOMFIELD" to "LABEL"

(3)inject the field value

In this case, custom field is only to facilitate document design and it will later be updated to a label field and no longer be related to sender profile.

 

Duo

 


Bikram | Posts: 33

Reply to: Text Field

0 votes

Hello Duo, 

Can you send me the example of such request with the payload. We are based in Australia, if you can response today would be great otherwise I have to wait a day for your response due to time difference. I hope you understand our situation 


Bikram | Posts: 33

Reply to: Text Field

0 votes

Thank you Duo, you are awesome. It solved my problem 


Bikram | Posts: 33

Reply to: Text Field

1 votes

Thank you Duo for your help. It is working perfectly now. 


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