jwilliams

There is a role with no signer error

0 votes

We have a template (in sandbox, id "M9fYtj_6L0MKQSYfQ3vAahQn6E8="). I've followed the documentation to attach signers.

We have 3 roles: Insured, SalesAgent, BankAccountOwner.

In my code, I'm calling package.WithSigner(...).Replace(new Placeholder("Insured, ...")) for all three roles (I've verified in my package that all 3 signers are added.

Package creation is successful, however when calling client.SendPackage(packageId), it gives the error:


{"Could not send the package. Exception: The remote server returned an error: (400) Bad Request. HTTP POST on URI https://sandbox.esignlive.com/api/packages/TuXMY0lZ6aQE_aZXWN6vmmW4LoA=. Optional details: {\"messageKey\":\"error.validation.packageActivation.unassignedRole\",\"message\":\"There is a role with no signer.\",\"code\":400,\"name\":\"Validation Error\"}"}

One somewhat unrelated recommendation: Your documentation is a bit all over the place - it drills down and gets so specific in the apis, that it rarely talks about the core concepts and how they link. For instance, the "Create a Package From a Template" docs (https://community.onespan.com/documentation/onespan-sign/guides/feature-guides/developer/create-package-template) talk about calling WithSigner(...).Replace(new Placeholder(PLACEHOLDER_ID)), but doesn't talk about where that id comes from. Is it an internal guid that I need to find? Is it the role name that I entered into the template? Why was I able to enter spaces in the template UI, but when passing spaces in the endpoint it says they are not allowed. I had to dig around to find the rest of that.


Reply to: There is a role with no signer error

0 votes

Hi Josh,

 

The label displayed as "Insured", "SalesAgent", "BankAccountOwner" are placeholder/role name, while what the SDK function required ".Replace(new Placeholder(PLACEHOLDER_ID))" is the placeholder/role ID. The idea is the ID is not changable once created (if you created the template through UI, the role ID is automatically generated, in format of UUID), but the role name should be editable and readable.

Below code snippet should work in this case:

            EslClient eslClient = new EslClient(apiKey, apiUrl);

            DocumentPackage template = eslClient.GetPackage(new PackageId("your_template_id"));
            IList<Signer> placeholders = template.Placeholders;
            string insuredRoleId = template.Placeholders.Where(p => p.PlaceholderName == "Insured").First().Id;
            string salesAgentRoleId = template.Placeholders.Where(p => p.PlaceholderName == "SalesAgent").First().Id;
            string bankAccountOwnerRoleId = template.Placeholders.Where(p => p.PlaceholderName == "BankAccountOwner").First().Id;

            DocumentPackage newPackage = PackageBuilder.NewPackageNamed("package created from template - 1")
                .WithSigner(SignerBuilder.NewSignerWithEmail("[email protected]")
                          .WithFirstName("PACKAGE_SIGNER_FIRST")
                          .WithLastName("PACKAGE_SIGNER_LAST")
                          .Replacing(new Placeholder(insuredRoleId)
                          ))
                .WithSigner(SignerBuilder.NewSignerWithEmail("[email protected]")
                          .WithFirstName("PACKAGE_SIGNER_FIRST")
                          .WithLastName("PACKAGE_SIGNER_LAST")
                          .Replacing(new Placeholder(salesAgentRoleId)
                          ))
                .WithSigner(SignerBuilder.NewSignerWithEmail("[email protected]")
                          .WithFirstName("PACKAGE_SIGNER_FIRST")
                          .WithLastName("PACKAGE_SIGNER_LAST")
                          .Replacing(new Placeholder(bankAccountOwnerRoleId)
                          ))
                .WithStatus(DocumentPackageStatus.SENT)
                .Build();
            PackageId packageId = eslClient.CreatePackageFromTemplate(new PackageId("your_template_id"), newPackage);

TIP: setting status as SENT directly saves you an API call to send the package.

And thanks for the suggestions! Although I normally address all of these details in my blog series if the topic has been covered, I think it's valuable to clarify these concepts in the guides as well and I will try to improve our guides in this aspect.

 

Duo

Duo Liang OneSpan Evangelism and Partner Integrations Developer


Reply to: There is a role with no signer error

0 votes

Thanks Duo, that makes sense. 

 


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