Michael_S_Smith

Group Signer CustomId Attribute

0 votes

I would like to be able to save a 'role' type attribute against a group signer - for example 'Insurance Agent'. I find when I save a signer of type group, the customId attribute is not returned when I request the package. Is there an attribute I can use on a group signer that will be returned to me when I get the package? It seems the system only wants to return the groupId. From this I can get the group name and the group email, but no additional signer attributes.


Reply to: Group Signer CustomId Attribute

0 votes

Hi Michael,

 

This is because when SDK converting from API modelling, "group" node which includes group members information won't be included in the converted SDK modelling. To work around this, PacakgeService class exposed a function allowing you to get the API package modelling, so assuming you created such a package:

 

        DocumentPackage myPackage = PackageBuilder.newPackageNamed("My Package with Group Signers Java Developers")
                .withSigner(SignerBuilder.newSignerFromGroup(new GroupId("bc6f0de7-c529-4e84-b96e-e53127c9038d"))
                        .withCustomId("InsuranceAgent")
                        )
                .withDocument(DocumentBuilder.newDocumentWithName("My Document").fromFile(FILE_PATH)
                        .withSignature(SignatureBuilder.signatureFor(new GroupId("bc6f0de7-c529-4e84-b96e-e53127c9038d")).onPage(0).atPosition(370, 680)))
                .build();

        PackageId packageId = eslClient.createPackageOneStep(myPackage);
        System.out.println(packageId);

You can retrieve the group members with below code snippet:        

        com.silanis.esl.api.model.Package apiPackage = eslClient.getPackageService().getApiPackage(packageId.getId());
        for (com.silanis.esl.api.model.Role role : apiPackage.getRoles()) {
            if("InsuranceAgent".equals(role.getName())) {
                com.silanis.esl.api.model.Group group = role.getSigners().get(0).getGroup();
                List<com.silanis.esl.api.model.GroupMember> members = group.getMembers();
                for (com.silanis.esl.api.model.GroupMember groupMember : members) {
                    System.out.println(groupMember.getEmail() + " : " + groupMember.getFirstName() + " " + groupMember.getLastName());
                }
            }
        }

 

Duo

Duo Liang OneSpan Evangelism and Partner Integrations Developer


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