talk2bks | Posts: 34

Using Template, How to Replace Placeholder Signers

0 votes

I am having trouble replacing the "Placeholder" signers for the template created. I have 2 signers setup as placeholders ('Signer1'). 

        //Build actual Role in replacement of placeholder
        String placeholder1Id = 'Signer1';
        OneSpanAPIObjects.Role role1 = new OneSpanAPIObjects.Role();
        OneSpanAPIObjects.Signer signer1 = new OneSpanAPIObjects.Signer();
        signer1.firstName = sign1_first;
        signer1.lastName = sign1_last;
        signer1.email = sign1_email;
        signer1.id = placeholder1Id;

 

        //use role id to match placeholder
        role1.signers = new List<OneSpanAPIObjects.Signer>{signer1};
        role1.id = placeholder1Id;

        pkg.roles = new List<OneSpanAPIObjects.Role>{role1};
        pkg.status = OneSpanAPIObjects.PackageStatus.DRAFT;
        pkg = sdk.helper.createPackageFromTemplate(pkg, 'xxxxxxxxxxxxxxxxxxxxxxxx=');

 

The transaction is being created just fine but the sign1 information is being added to the bottom of the signer's list and the placeholders


Approved Answer
Duo_Liang | Posts: 3776

Reply to: Using Template, How to Replace Placeholder Signers

0 votes

Hi Brian,

 

Can I have the template ID? Because if you've created the template from UI, the placeholder's ID is probably not Signer1 (the UI label refers to the role name instead of ID).

 

Duo


talk2bks | Posts: 34

Reply to: Using Template, How to Replace Placeholder Signers

0 votes

I'm sure that's the case. Do I need to get the placeholder id's first, then replace?

Template ID = jRwMThEo6E25qkTcTG-QgKBfijM=


Duo_Liang | Posts: 3776

Reply to: Using Template, How to Replace Placeholder Signers

0 votes

Hi Brian,

 

Try to use below two placeholder IDs:

Signer1: rd5337RVVo4V

Signer2: A4ulZ6R9FVIV

 

Let me know if it doesn't resolve the issue.

 

Duo


talk2bks | Posts: 34

Reply to: Using Template, How to Replace Placeholder Signers

0 votes

For future reference, how do I get these id's?


Duo_Liang | Posts: 3776

Reply to: Using Template, How to Replace Placeholder Signers

1 votes

Hi Brian,

 

You can get the actual placeholder IDs by querying this API:
GET /api/packages/{template_id}

It's under "roles" > "id".

 

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