kamranwali | Posts: 27

Document without signature

0 votes

Hi,

I am getting following error when I am creating a new package with two documents.

"The role must have at least one signature on the document in order to have associated fields."

Package id: ysKrGN_i6ZUvO6gwRGzzqoYXGdM=

 

My scanario is, there are two documents in the package, one document has some text fields and checkboxes but no signature field, while the other document has signature field. Signer has to enter data in input fields in one documents and sign the other one.

This is the code I am using

 

OssClient ossClient = GetOssClient();

            DocumentPackage documentPackage =
                PackageBuilder.NewPackageNamed("Consumer documents")
                    .DescribedAs("This is a package created using the eSignLive SDK")
                    .ExpiresOn(DateTime.Now.AddMinutes(100))
                    .WithEmailMessage("This message should be delivered to all signers")
                    .WithoutAutomaticCompletion()
                    .Build();

            foreach (var signee in requestDto.Signees)
            {
                var signer = SignerBuilder.NewSignerWithEmail(signee.Email)
                      .WithCustomId(signee.CustomId)
                      .WithFirstName(signee.FirstName)
                      .WithLastName(signee.LastName)
                      .WithSMSSentTo(signee.MobileNumber)
                      .SigningOrder(signee.SigningOrder)
                      .Build();

                documentPackage.Signers.Add(signer);
            }

            foreach (var document in requestDto.Documents)
            {
                var bytesFromBase64String = Convert.FromBase64String(document.DocumentContent);

                MemoryStream stream = new MemoryStream(bytesFromBase64String);

                var document1 = DocumentBuilder.NewDocumentNamed(document.DocumentName)
                    .FromStream(stream, DocumentType.PDF)
                    .WithId(document.DocumentId)
                    .WithExtractionType(ExtractionType.TEXT_TAGS)
                    .EnableExtraction().Build();

                documentPackage.Documents.Add(document1);
            }

            var packageId = ossClient.CreateAndSendPackage(documentPackage);

 

 

Thanks,

Kamran


Duo_Liang | Posts: 3776

Reply to: Document without signature

0 votes

Hi Kamran,

 

Thanks for your post!

First of all, in order to use the no signature field, have you contacted our support team ([email protected]) and have the feature turned on at your account?

On top of that, I don't think at this point the Text Tags feature supports No Signature Field. As a workaround, I would suggest to either use other methods to place the fields (e.g. text anchor if your application knows the number of fields and their field type), or apply a two-step approach that (1) use text tags to place both the fields and signatures (2) retrieve the field information, delete and re-add the signature, see below sample code: 

            ......

            //Step1
            var document1 = DocumentBuilder.NewDocumentNamed("DirectDebitForm")

                .FromStream(fs, DocumentType.PDF)
                .WithId("DirectDebitForm")
                .WithExtractionType(ExtractionType.TEXT_TAGS)
                .EnableExtraction().Build();

            documentPackage.Documents.Add(document1);

            var packageId = ossClient.CreatePackageOneStep(documentPackage);

            //Step2
            DocumentPackage createdPkg = ossClient.GetPackage(packageId);
            Document createdDoc = createdPkg.GetDocument("DirectDebitForm");
            foreach (Signature signature in createdDoc.Signatures)
            {
                ossClient.ApprovalService.DeleteApproval(packageId, createdDoc.Id, signature.Id.Id);


                SignatureBuilder sb = SignatureBuilder.AcceptanceFor(signature.SignerEmail);

                foreach (Field field in signature.Fields) {
                    sb.WithField(field);
                }


                ossClient.ApprovalService.AddApproval(createdPkg, createdDoc.Id, sb.Build());
            }

            ossClient.SendPackage(packageId);

 

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