This topic contains 5 replies, has 2 voices, and was last updated by  Duo_Liang 2 months, 3 weeks ago.

  • Author
    Posts
  • Participant
    laenailk
    Newbie
    Member since: 04.01.2018
    Number of posts: 5

    Our client is receiving the above error message when trying to send a package. We are not creating and sending a CustomID, so not sure what the problem is. They only receive this error periodically.

    Here is the log file error:
    02/28/2019 08:30:39.00: No Role found for signer email xxx@example.com
    02/28/2019 08:30:39.00: at Silanis.ESL.SDK.DocumentConverter.FindRoleIdForSigner(String signerEmail, Package createdPackage)
    at Silanis.ESL.SDK.DocumentConverter.ToAPIDocument(Package apiPackage)
    at Silanis.ESL.SDK.Services.PackageService.UploadDocuments(PackageId packageId, IList`1 documents)
    at Silanis.ESL.SDK.EslClient.CreatePackage(DocumentPackage package)
    at Contraxx.External.CtxPackageInfo.BuildAndSendPackage(List`1 documents, String exDate, Int32 firstReminder, Int32 daysBetweenReminders, Int32 numReminders)

    Here is our code to create a signer:
    SignerBuilder newSigner = SignerBuilder.NewSignerWithEmail(signer.email)
    .WithFirstName(signer.firstName)
    .WithLastName(signer.lastname)
    .WithTitle(signer.title)
    //.WithCustomId(signer.ID)
    .SigningOrder(signer.signingOrder)
    .WithEmailMessage(signer.emailMessage);
    pkg.WithSigner(newSigner);

    • This topic was modified 2 months, 3 weeks ago by  Duo_Liang.
    Keymaster
    Duo_Liang
    Guru
    Member since: 14.06.2018
    Number of posts: 828

    Score

    0

    Hi laenailk,

    Thanks for posting on our Developer Community!
    Can I have your package ID and which environment are you in? From the error message and stack trace, it seems signer is not successfully added to the package. So we make sure the pkg object added with signer is the same reference when you passing in the EslClient.CreatePackage(DocumentPackage package) function?

    Also, a completed code snippet of your workflow could help troubleshoot this issue. You can both share the code in this thread or send to developer@esignlive.com.

    Duo


    Duo Liang
    OneSpan Junior Technical Evangelist
    Participant
    laenailk
    Newbie
    Member since: 04.01.2018
    Number of posts: 5

    Score

    0

    Hi,

    There is no package ID; the package does not get created because of the error message.

    The real mystery is why this only happens very occasionally; 99% of the packages are created with no problem.

    Here is the code from creating the signer to the line where the error occurs:

    try
    {
    foreach (CtxRecipientInfo signer in signers)
    {

    SignerBuilder newSigner = SignerBuilder.NewSignerWithEmail(signer.email)
    .WithFirstName(signer.firstName)
    .WithLastName(signer.lastname)
    .WithTitle(signer.title)
    //.WithCustomId(signer.ID)
    .SigningOrder(signer.signingOrder)
    .WithEmailMessage(signer.emailMessage);
    pkg.WithSigner(newSigner);
    }
    }
    catch (Exception ex)
    {
    errorMessage = ex.Message;
    PortalUtils.WriteToLogfile(errorMessage, “”);
    PortalUtils.WriteToLogfile(ex.StackTrace, “”);
    throw;
    }
    }

    /// <summary>
    /// Add signature section for the given signer (idenified by email address)
    /// </summary>
    /// <param name=”document”></param>
    /// <param name=”signer”></param>
    public void AddSignatureToDocument(DocumentBuilder document, CtxRecipientInfo signer)
    {
    try
    {
    if (signer.recipientType == CtxRecipientInfo.RecipientType.AcceptOnly)
    {
    AddAcceptOnly(document, signer);
    }
    else
    {
    TextAnchor sigAnchor = new TextAnchor();
    sigAnchor.Position = TextAnchorPosition.TOPLEFT;
    sigAnchor.YOffset = signer.yOffset;
    sigAnchor.XOffset = signer.xOffset;
    sigAnchor.Height = signer.height;
    sigAnchor.Width = signer.width;
    sigAnchor.AnchorText = signer.anchorText;

    TextAnchor dateAnchor = new TextAnchor();
    dateAnchor.Position = TextAnchorPosition.TOPLEFT;
    dateAnchor.YOffset = signer.signingDateInfo.yOffset;
    dateAnchor.XOffset = signer.signingDateInfo.xOffset;
    dateAnchor.Height = signer.signingDateInfo.height;
    dateAnchor.Width = signer.signingDateInfo.width;
    dateAnchor.AnchorText = signer.signingDateInfo.anchorText;

    TextAnchor titleAnchor = new TextAnchor();
    titleAnchor.Position = TextAnchorPosition.TOPLEFT;
    titleAnchor.YOffset = signer.signingTitle.yOffset;
    titleAnchor.XOffset = signer.signingTitle.xOffset;
    titleAnchor.Height = signer.signingTitle.height;
    titleAnchor.Width = signer.signingTitle.width;
    titleAnchor.AnchorText = signer.signingTitle.anchorText;

    document.WithSignature(SignatureBuilder.SignatureFor(signer.email)
    .WithPositionAnchor(sigAnchor)
    .WithField(FieldBuilder.SignerTitle()
    .WithPositionAnchor(titleAnchor))
    .WithField(FieldBuilder.SignatureDate()
    .WithPositionAnchor(dateAnchor)));
    }
    }
    catch (Exception ex)
    {
    errorMessage = ex.Message;
    PortalUtils.WriteToLogfile(errorMessage, “”);
    PortalUtils.WriteToLogfile(ex.StackTrace, “”);
    throw;
    }
    }

    /// <summary>
    ///
    /// </summary>
    /// <param name=”document”></param>
    /// <param name=”signer”></param>
    public void AddAcceptOnly(DocumentBuilder document, CtxRecipientInfo signer)
    {
    try
    {

    document.WithSignature(SignatureBuilder.AcceptanceFor(signer.email));
    }
    catch (Exception ex)
    {
    errorMessage = ex.Message;
    PortalUtils.WriteToLogfile(errorMessage, “”);
    PortalUtils.WriteToLogfile(ex.StackTrace, “”);
    throw;
    }
    }

    /// <summary>
    /// Complete the back building process and send the package.
    /// </summary>
    /// <param name=”documents”></param>
    /// <param name=”expirationDate”></param>
    /// <param name=”firstReminder”></param>
    /// <param name=”daysBetweenReminders”></param>
    /// <param name=”numReminders”></param>
    /// <returns></returns>
    public String BuildAndSendPackage(List<DocumentBuilder> documents,
    string exDate = “”,
    int firstReminder = 0,
    int daysBetweenReminders = 0,
    int numReminders = 0)
    {
    PackageId package = null;
    try
    {
    //Haven’t add the documents to the package yet.
    foreach (DocumentBuilder docBuilder in documents)
    {
    pkg.WithDocument(docBuilder);
    }
    //Initialize the eSignClient
    EslClient client = new EslClient(apiKey, url);

    DocumentPackage docPackage = pkg.Build();
    package = client.CreatePackage(docPackage);

    Keymaster
    Duo_Liang
    Guru
    Member since: 14.06.2018
    Number of posts: 828

    Score

    0

    Hi laenailk,

    Because you are using EslClient.CreatePackage(DocumentPackage package) function.
    Internally, SDK will separate the process into three calls:
    1. first create a package with signers and all other settings
    2. retrieve the created package
    3. then, upload document files and their metadata. In this process SDK will compare the retrieved package to the object you created locally, the exception appears right in this step when SDK was converting SDK object to REST object, it was trying to matching the signer you set in your document object locally to the created package.

    So my suggestion here could be, you can use EslClient.CreatePackageOneStep(DocumentPackage package) instead CreatePackage where a fully-baked package will be sent within one call vs three calls.

    And as I mentioned above, even though you didn’t receive PackageId object due to the exception, a package actually should have been created where you can check on your webportal(sandbox/apps.esignlive.com/login).

    Duo


    Duo Liang
    OneSpan Junior Technical Evangelist
    Participant
    laenailk
    Newbie
    Member since: 04.01.2018
    Number of posts: 5

    Score

    0

    Duo, thank you very much for the explanation. We will definitely switch over to the “one-step” approach. Do we need to change anything else to accommodate this, or just call it in place of the other one?

    Keymaster
    Duo_Liang
    Guru
    Member since: 14.06.2018
    Number of posts: 828

    Score

    0

    Hi laenailk,

    No, given the code snippet, you don’t need to change anywhere else.

    There would be only few scenarios you need to change your code, and one of them is,
    when you added signatures for your sender/owner while you didn’t explicitly assign him/her as a signer with the function .WithSigner().
    CreatePackage function first created a package internally and sender will automatically be added to your package so you don’t need to manually add them, while CreatePackageOneStep function requires you to include all signers before creation.

    In your case, since all signatures have been binded to CtxRecipientInfo objects whom have already been added to package, this difference won’t affect you.

    Duo


    Duo Liang
    OneSpan Junior Technical Evangelist

You must be logged in to reply to this topic.