Madeva | Posts: 29

How to have tags inside file document for custom fields to inject the field value dynamically?

0 votes

Hi Team,

I have to inject the fields in a specific location of the document.. so I have to put tags for that,

what is the tags for field injection? as I am placing tag as  {{esl_Adid:AdId:customField:Size(150,15)}}

 but getting following error.

 

{

    "code": 400,

    "messageKey": "error.validation.texttag.missingRequiredInformation",

    "parameters": {

        "tag": "{{esl_Adid:AdId:customField:Size(150,15)}}"

    },

    "message": "{{esl_Adid:AdId:customField:Size(150,15)}}: Missing Role Name and/or Field Type.",

    "name": "Validation Error"

}

 

PFA of document used and highlighted in yellow color for the injection field tag

and also payload json.

 

 

Please help me to  inject field dynamically from payload and based on tag.

 

Thanks 

Madeva


Duo_Liang | Posts: 3776

Reply to: How to have tags inside file document for custom fields to inject the field value dynamically?

0 votes

Hi Madeva,

 

In your text tags "{{esl_Adid:AdId:customField:Size(150,15)}}", it seems you were trying to add a custom field. First please be advised that the custom field is not supported in text tag syntax, as per the documentation. (Also, custom field feature is only for senders, which contains supplementary information hosted in sender profile, versus inject value dynamically from payload)

 

In order to inject value to document, using text tags feature, you can add a label field using below syntax (I also attached a sample document):

 {{esl:Signer1:label:value("This is a test label"),size(200,50)}}

 

And this is how it looks like in New Signer Experience (much more nature than classic Signing Ceremony in terms of rendering label fields):
6-10-1

 

Duo


Attachments
Madeva | Posts: 29

Reply to:

0 votes

Hi Duo,

 

Thanks for the reply, 

Is there any way that I could pass/inject the value to the label field from payload JSON?,  So the value to the label field is dynamic.

 

And also can you explain how the following field injection is working

https://community.onespan.com/documentation/onespan-sign/guides/feature-guides/developer/field-injection

is that document has tags?

 

Regards

Madava


Duo_Liang | Posts: 3776

Reply to: How to have tags inside file document for custom fields to inject the field value dynamically?

1 votes

Hi Madava,

 

Field Injection feature uses PDF forms as anchor to pinpoint the position and the size of the text (versus using text tags). It allows you to inject value using payload, but only during the package creation call. 

 

Back to adding label fields with text tags, in order to set values using JSON, you have to use additional API calls:

(1)upload the document with text tags where, for eaxmple, the signature ID of "Signature1" and the label field ID of "LabelField1"

(2)before sending the package, invoke two extra APIs to update the label field value:

- Pull the label field metadata:
GET /api/packages/{packageId}/documents/{documentId}/approvals/Signature1/fields/LabelField1

- With the response payload returned from first call, update the "value" attribute and send back the payload with a PUT call:
PUT /api/packages/{packageId}/documents/{documentId}/approvals/Signature1/fields/LabelField1

Performing a update field call will replace the field attributes with the ones defined in the update payload. That's why need to invoke a GET call prior to make sure all the attributes are included.

(3)send out the package after it's properly designed.

 

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