Michael_S_Smith | Posts: 66

Multiple Signers With Same Email

0 votes

Trying to follow the example here: https://www.onespan.com/blog/onespan-sign-developer-multiple-signers-sharing-same-email

But I am getting the exception below when I add a second signer with:

               osSigner = newSignerWithEmail(theSigner.getEmail()).withFirstName(theSigner.getFirstName())
                        .withLastName(theSigner.getLastName()).withCustomId(theSigner.getUserId())
                        .signingOrder(pkg.isNotarized() ? 0 : theSigner.getSigningOrder()).build();

com.silanis.esl.sdk.EslException: Another signer with same email or another placeholder with same id already exists.
    at com.silanis.esl.sdk.DocumentPackage.addSigner(DocumentPackage.java:88)

My 2 signers very clearly have distinct 'customIds' so why do I get this error?

The only difference I see between my code and the example is our code creates the signers first then runs thru and creates the documents after that. Is that the problem? If so is there a workaround which will not require us to refactor our code?

 

Thanks


Duo_Liang | Posts: 3776

Reply to: Multiple Signers With Same Email

0 votes

Hi Michael,

 

In short, try to use below code instead of DocumentPackage.addSigner() function:

        EslClient eslClient = new EslClient(API_KEY, API_URL);
        
        DocumentPackage pkg1 = PackageBuilder.newPackageNamed("Example Package " + System.currentTimeMillis())
           .build();
        
        Signer signer1 = SignerBuilder.newSignerWithEmail("[email protected]" )
                .withFirstName("Doe")
                .withLastName("Mary")
                .withCustomId("Signer1")
                .build();
        Signer signer2 = SignerBuilder.newSignerWithEmail("[email protected]" )
                .withFirstName("Doe")
                .withLastName("John")
                .withCustomId("Signer2")
                .build();
        
        List<Signer> signers = pkg1.getSigners();
        signers.add(signer1);
        signers.add(signer2);

        
        PackageId createPackageOneStep = eslClient.createPackage(pkg1);

 

This is a local error generated by the SDK logic, hence it might be better if we raise it to R&D team and ask for removing the check existing logic (by signer email).

 

Duo


Michael_S_Smith | Posts: 66

Reply to:

0 votes

Thanks. I need a bit more help with this. I can add 2 signers this way with customIds and that works. I then add Signatures like so (not all the code shown):

List<Signature> theSignableDocSignatures = new ArrayList<>();

Loop -

Signature sig = SignatureBuilder.signatureFor(new Placeholder(<one of the signer custom ids>)).build();

theSignableDoc.addSignatures(theSignableDocSignatures);

 

This works and creates a package - b_NyiFmu_FgsT_cQ9Seg7YZ-GtQ= for example - but I do not see any data in the DocumentPackage that tells me which signature blocks are tied to which signer. The Signature has some kind of id, but I do not see how it ties to a signer. I would expect Signature.getRoleId to return the Placeholder, but that is null.

I think this would be much easier if we could tie the Signature directly to the signer customId - similar to how we do with email (when they are unique). This seems unnecessarily complex to me.

So my question is - looking at b_NyiFmu_FgsT_cQ9Seg7YZ-GtQ - how do I know which signatures are tied to which signer? When I used email I could see that. Now I get a generated 'signatureId'. I had expected this to be the signer's customId.


Duo_Liang | Posts: 3776

Reply to:

0 votes

Hi Michael,

 

Thanks for the information, I can reproduce the same. After checking the SDK source code, I think this is because the signature's role ID only has value when it's placeholder signers. For real signers, the SDK still looks for their emails - if you print out the signature.getSignerEmail(), you will see the value.

A very quick workaround is to include signer's ID as part of the signature ID:

        Signer signer1 = SignerBuilder.newSignerWithEmail("[email protected]" )
                .withFirstName("Doe")
                .withLastName("Mary")
                .withCustomId("Signer1")
                .build();

        Signature sig1 = SignatureBuilder.signatureFor(new Placeholder("Signer1"))
                .withId(new SignatureId("Signer1_Signature1"))
                .atPosition(100, 100)
                .onPage(0)
                .withSize(150, 50)
                .build();

At the same time, I think we can raise these two issue to R&D team. If you preferred, I can create the support ticket for you.

 

Duo


Michael_S_Smith | Posts: 66

Reply to: Multiple Signers With Same Email

0 votes

Yes please create the tickets thanks.

Our product folks are eager to have the capability for multiple signers to share an email. The suggested workaround is difficult as each SignatureId needs to be unique. I would need to keep track of how many signatures are for each signer and this would make updating much more difficult.

 

I think if SignatureBuilder.signatureFor(Placeholder) puts the palceholder in the signature that would work. Easier (I think) is to provide a SignatureBuilder.signatureFor that takes the signer customId and puts that on the signature.

Mike


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