shivgonarkar | Posts: 22

create one package using multiple template

0 votes

We have a requirement like below

We will create few contract document templates(PDF) in onespan using onespan console. These document will have various fields(name, age etc) which will have to be populated programetically during esign journey. 

we also have few number of optional document templates which user might want to add as a part of the package during esign. They can add one or more optional documents. Template of optional document will be also present in onespan. 

If I understood correctly , we have to call "{{baseUrl}}/api/packages/{{packageid}}/clone" API and pass all the data (name, age etc) in key value form to create package from template during the esign journey. So when users esign journey they will have template with prepopulated data.

My question , is it possible to create one package (like envelope) with multiple templates , This package can be created using multiple template Id which I can pass along with the data which should be prepopulated. 

 


Duo_Liang | Posts: 3776

Reply to: create one package using multiple template

0 votes

Hi shivgonarkar,

 

Welcome to OneSpan Sign! 

Yes, if you call the clone call and pass field values at "documents" array > "approvals" array > "fields" array > filter field by its id/name, and set "value" attribute.

Below is an example shows you how the JSON payload looks like in the clone call (I have highlighted the value attribute and where to set placeholder recipient's f/lname and email):

POST /api/packages/{templateId}/clone

{
  "description": "",
  "documents": [
    {
      "id": "Document1",
      "name": "Document1",
      "index": 1,
      "approvals": [
        {
          "role": "b17cde62-181b-45a7-9643-d75c42872226",
          "id": "zwQBbwKQ7p00",
          "fields": [
            {
              "binding": null,
              "validation": {
                "group": "",
                "required": false,
                "maxLength": null,
                "minLength": null,
                "errorMessage": "",
                "disabled": false,
                "errorCode": null,
                "minimumRequired": null,
                "maximumRequired": null,
                "enum": null,
                "pattern": ""
              },
              "id": "lnt6MykHtisZ",
              "data": null,
              "fontSize": null,
              "subtype": "TEXTFIELD",
              "page": 0,
              "extractAnchor": null,
              "formattedValue": "",
              "left": 91.0,
              "width": 165.0,
              "height": 37.0,
              "extract": false,
              "top": 348.0,
              "type": "INPUT",
              "value": "some value for field1 in doc1",
              "name": ""
            },
            {
              "binding": null,
              "validation": null,
              "id": "2t1cgWgdXTA3",
              "data": null,
              "fontSize": null,
              "subtype": "FULLNAME",
              "page": 0,
              "extractAnchor": null,
              "formattedValue": "",
              "left": 117.0,
              "width": 165.0,
              "height": 37.0,
              "extract": false,
              "top": 509.0,
              "type": "SIGNATURE",
              "value": "",
              "name": ""
            }
          ]
        }
      ]
    }
  ],
  "due": null,
  "emailMessage": "",
  "language": "en",
  "roles": [
    {
      "id": "b17cde62-181b-45a7-9643-d75c42872226",
      "emailMessage": {
        "content": ""
      },
      "reassign": false,
      "deliverDocumentsByEmail": false,
      "attachmentRequirements": [],
      "type": "SIGNER",
      "index": 0,
      "signers": [
        {
          "firstName": "john",
          "lastName": "smith",
          "email": "[email protected]"
        }

      ],
      "name": "Signer1"
    }
  ],
  "settings": {
    "ceremony": {
      "declineButton": true,
      "declineReasons": [],
      "disableDeclineOther": false,
      "disableDownloadForUncompletedPackage": false,
      "disableFirstInPersonAffidavit": false,
      "disableInPersonAffidavit": false,
      "disableOptOutOther": false,
      "disableSecondInPersonAffidavit": false,
      "documentToolbarOptions": null,
      "events": null,
      "handOver": null,
      "hideCaptureText": false,
      "hideLanguageDropdown": false,
      "hidePackageOwnerInPerson": false,
      "hideWatermark": false,
      "inPerson": false,
      "remoteOnlineNotarization": false,
      "maxAuthFailsAllowed": null,
      "optOutButton": false,
      "optOutReasons": [],
      "leftMenuExpand": false,
      "enforceCaptureSignature": false,
      "extractAcroFields": true,
      "extractTextTags": true,
      "ada": false,
      "fontSize": 14,
      "defaultTimeBasedExpiry": true,
      "remainingDays": 21,
      "maximumRemainingDays": 0,
      "maxAttachmentFiles": 0,
      "showNseHelp": false,
      "showNseOverview": false,
      "optionalNavigation": false,
      "showNseLogoInIframe": false,
      "geolocation": false,
      "adHocCobrowsingSigner": false,
      "timestampOnSignature": false,
      "layout": {
        "header": {
          "feedback": true,
          "breadcrumbs": true,
          "globalActions": {
            "hideEvidenceSummary": false,
            "confirm": true,
            "download": true,
            "saveAsLayout": false
          },
          "globalNavigation": true,
          "sessionBar": true,
          "titleBar": null
        },
        "footer": null,
        "brandingBar": null,
        "navigator": true,
        "iframe": false
      },
      "style": null
    }
  },
  "status": "SENT",
  "timezoneId": "Australia/Sydney",
  "data": {
    "senderVisible": false,
    "origin": "OSS"
  },
  "name": "transaction created out of template"
}

 

For your other question "is it possible to create one package with multiple templates", do you mean to add those optional documents? If that's the case, it's possible to select partially documents in the clone call. For example you have Document1,2,3 in the template and you only want to add Document1 and 2 in the transaction, build the clone payload like this:

{

"documents":[

    {"id":"Document1",......},

    {"id":"Document2",......}

],

......

}

Let me know if this helps.

 

Duo

 

 


shivgonarkar | Posts: 22

Reply to: create one package using multiple template

0 votes

Thanks for your reply. My second question is slightly different....

Let me say I have three products

ProductA  => This will have one template TemplateA in Onespan (with fields)... I can have one or more doc but not from optional doc

ProductB =>  This will have one template TemplateB in Onespan (with fields)... .. I can have one or more doc but not from optional doc

ProductC =>  This will have one template TemplateC in Onespan (with fields)..... I can have one or more doc but not from optional doc

 

And there are few optional Documents .....which can be part of any of the above contract document in the signing ceremony of productA , productB and ProductC

I want to keep below template seperate

Example :

Optional1  => This will have one template Template1 in Onespan (with fields)... and only one document

Optional2  => This will have one template Template2 in Onespan (with fields)... and only one document

Optional3  => This will have one template Template3 in Onespan (with fields)... and only one document

 

So the scenario could be , I want to create package (transaction) with ProductA(templateA) and Optional (Template1) .... Optional (Template2)

Or in some scenario Sender want to attach all three optional templates to main product document.

 

As explained here, optional document are not part of same package/template of Product template.

 

So we want to clone and create package like [ {TemplateA, Fields} {Template1,Fields}]  or in some cases [{TemplateB, Fields} {Template1,Fields},{Template2,Fields}]

 

We have around 10 to 15 optional document and user may want to attach 1 to 5 optional document out of these list of 15 to the main contract(product) document.  These same optional documents can be attached to any of the contract(product) document.

One of the option as per your solution can be to add these 15 documents to each contract template. But As optional document are many , we want to keep these documents as part of seperate one or more template

Please let me know how this can be done


Duo_Liang | Posts: 3776

Reply to: create one package using multiple template

0 votes

Hi shivgonarkar,

 

Thanks for the clarification! Unfortunately a transaction can only be applied one template, that's why I was suggesting to add all optional documents to all the templates, and select from them in the clone call. 

For each optional document, you can save the fields and signatures design as a layout. This helps to deploy changes and sync all its appearance.

 

Duo


shivgonarkar | Posts: 22

Reply to: create one package using multiple template

0 votes

Just wanted to know your opinion on below approach ,

Do you see any issue with below approach

 

1) clone the main template 

2) get the optional template and extract the document objects from it 

3) pull PDFs of each optional document using :

GET {{baseUrl}}/api/packages/:packageId/documents/:documentId/original

 

 and post them into the newly created clone using 

POST {{baseUrl}}/api/packages/:packageId/documents


Duo_Liang | Posts: 3776

Reply to: create one package using multiple template

0 votes

Hi shivgonarkar,

 

Yes, this approach is technical feasible. Just make sure (1)the document ID is unique (2)under approvals, make sure the role ID(s) match the signers in your main template.

 

Duo


shivgonarkar | Posts: 22

Reply to: create one package using multiple template

0 votes

Hi Duo , 

This approach is working fine for me.

I have got one new requirement. One of the optional document which I uploaded as PDF, I want that to appear first even before the document in main template. Could you please let me know how can we achieve it.  Basically can we recorder the document sequence after package is created and additional document attached as mentioned like above. Thanks


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