nehme

Placeholder Update

0 votes
Hello, I have already a template with 2 placeholders called Signer1 and Signer2. When creating a document packge from the template, how I can update these placeholders to add the email address and first and last name for the signers. Do you have such an example? Already my placeholder created inside a template in sandbox. Thanks

Approved Answer

Reply to: Placeholder Update

0 votes
Hi nehme, You can use following two lines to retrieve placeholder's ID:
DocumentPackage package_old = eslClient.GetPackage(new PackageId(packageId));
string id1 = package_old.Placeholders.ElementAt(0).Id;
string id2 = package_old.Placeholders.ElementAt(1).Id;

or

string id1 = "";
string id2 = "";
foreach (var signer in package_old.Placeholders) {
    if (signer.PlaceholderName == "Signer1") {
                     id1 = signer.Id;
                }
   else if (signer.PlaceholderName == "Signer2")
                {
                     id2 = signer.Id;
                }
            }
If you create your template through WebUI, the only thing to locate the specific signer is the placeHolderName I believe. So if you can, still suggest to use SDK to create the template so that you can assign your placeholder ID already. Duo

Duo Liang OneSpan Evangelism and Partner Integrations Developer


Reply to: Placeholder Update

0 votes
Hi nehme, Below is the API and a JSON example for update placeholders:
POST /api/packages/{template ID}/clone

{
   "name":"Package created from template through REST API",
   "status":"SENT",
   "roles":[
      {
         "id":"role ID for signer1",
         "type":"SIGNER",
         "signers":[
            {
               "id":"signer1ID",
               "firstName":"1.firstname",
               "lastName":"1.lastname",
               "email":"[email protected]"
            }
         ],
         "name":"Role1 Name"
      },
      {
         "id":"role ID for signer2",
         "type":"SIGNER",
         "signers":[
            {
               "id":"signer2ID",
               "firstName":"2.firstname",
               "lastName":"2.lastname",
               "email":"[email protected]"
            }
         ],
         "name":"Role2 Name"
      }
   ]
}
From my experience, if you create the template from WebUI, your roles' IDs will be generated randomly, so I'd suggest to create templates through calling API/SDK. Hope this could help you! Duo

Duo Liang OneSpan Evangelism and Partner Integrations Developer


Reply to: Placeholder Update

0 votes
Hello, Thanks for the info. But how I will do it by using .Net SDK? C# Thanks

Reply to: Placeholder Update

0 votes
Hi nehme, Below is the C# snippet for you:
String packageId = "zS4Ja624YHq3XZMgEWTURNP_dfk=";
DocumentPackage package = PackageBuilder.NewPackageNamed("test from template")
                .WithSigner(SignerBuilder.NewSignerWithEmail("[email protected]").WithFirstName("1.firstname").WithLastName("1.lastname").WithCustomId("fd651a15-b2f4-4937-bd44-f96e3a60f076").Build())
                .WithSigner(SignerBuilder.NewSignerWithEmail("[email protected]").WithFirstName("2.firstname").WithLastName("2.lastname").WithCustomId("e399a1bf-1417-49a0-b4e4-18088f4692ff").Build())
                .Build();
PackageId newPackageId = eslClient.CreatePackageFromTemplate(new PackageId(packageId),package);
You just need to create a new package object with signers you want to replace the placeholders and other infos you want to replace from the template and call CreatePackageFromTemplate()function. The request payload is almost the same as above JSON. Duo

Duo Liang OneSpan Evangelism and Partner Integrations Developer


Reply to: Placeholder Update

0 votes
Thanks for all the help. How did you get the CustomID?? WithCustomId("fd651a15-b2f4-4937-bd44-f96e3a60f076") ? Thanks

Reply to: Placeholder Update

0 votes
Thanks for all the support. This is what I wanted and solve my issue. :)

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