r-mikolajuk

How to pass values when cloning template

0 votes
I'm using the POST /packages/{packageId}/clone API call to create package from template. The template has some fields added and I want to fill one of them so the signer will not be able to change it. Is it possible? And if yes, what parameters I need to pass in JSON payload to do so?

Approved Answer

Reply to: How to pass values when cloning template

0 votes
In this case, you can create a label field after you've created a package from your template and add it to your document. To create a label field with REST, you make a request tohttps://sandbox.esignlive.com/api/packages/{packageId}/documents/{documentId}/approvals/{approvalId}/fields/ with the following JSON:
{
          "subtype": "LABEL",
          "page": 0,
          "top": 50,
          "height": 30,
          "left": 300,
          "width": 150,
          "type": "INPUT",
          "value": "email_address",
          "name": "field_name"
}
You will need to retrieve the document ID and approval ID, which you can get by making a GET request to: https://sandbox.esignlive.com/api/packages/{packageId}
Haris Haidary OneSpan Technical Consultant

Reply to: How to pass values when cloning template

0 votes
You can create a custom field for this. The simplest way would be to create it from the UI (under ACCOUNT and click on the custom fields tab) and add it to your template. This way, the field will auto-populate when your signer signs the document. I attached a sample custom field setting. When you send your package for signing, the field name will appear on the document. Once your signer signs the document, the field will auto-populate with default value. Hope this helps!
Haris Haidary OneSpan Technical Consultant

Attachments

Reply to: How to pass values when cloning template

0 votes
Thank you Haris for your response. How do I pass the value with the JSON payload, do you have any snippet for that? The case is that it will be an e-mail address, different for every document created, but still it may not be changed by signer.

Reply to: How to pass values when cloning template

0 votes
So the best scenario would be to create new package (clone template) but without sending it to the signer, then add the label field and then finally edit the package to send it to the signer?

Reply to: How to pass values when cloning template

0 votes
If you're creating packages from a template, then yes it would be the best way to do it.
Haris Haidary OneSpan Technical Consultant

Reply to: How to pass values when cloning template

0 votes
Thank you for your help, I'll try with this approach.

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