Add document to existing package
Sunday, September 25, 2022 at 11:23pmI was trying to add a new document to existing package and got the following error
Cannot edit or delete package.","name":"Access Denied"
I serached the forum and found out that the package should be in draft state, so I changed the status to draft and able to add new document to the packge, but now when I click on the link in email, I am getting "Unauthorized Access", also on the sandbox admin site, I can not see the new document which I added later.
I have attached the screen shots, also the code I used.
Document document = DocumentBuilder.NewDocumentNamed("Example Document")
.FromStream(fs, DocumentType.PDF)
.WithId("document1")
.WithDescription("Sample Document Description")
.Build();
PackageId packageId = new PackageId("{PackageId}");
var retrievedPackage = ossClient.GetPackage(packageId);
ossClient.ChangePackageStatusToDraft(packageId); //sent to draft
document = ossClient.UploadDocument(document, packageId);
document.Name = "Updated document name";
document.Description = "updated document description";
document.Signatures.Add(SignatureBuilder.SignatureFor("emailaddress")
.OnPage(0)
.AtPosition(200, 200)
.Build());
ossClient.PackageService.UpdateDocumentMetadata(retrievedPackage, document);
Console.WriteLine("Document was updated");
If you need any other information please let me know.
Our requirement is, we should be able to add documents after creating the package, signers could be the existing signers or new signers.
Other issue we faced is, once the package is completed we can not change the status back to Draft
This is the error messag we are getting back
{"messageKey":"error.validation.cannotChangePackageStatus","message":"Cannot change package status.","code":400,"name":"Validation Error"}
Thanks,
Kamran
Reply to: Add document to existing package
Thursday, September 29, 2022 at 05:53amHi Kamran,
Yes, once a document has started to be signed, you can no longer edit its fields, or to replace the document. You will have to delete the document and re-add a new one.
You can check the signing status of a document with below function:
SigningStatus pkgStatus = ossClient.GetSigningStatus(packageId, null, documentId);
Duo
Reply to: Add document to existing package
Monday, September 26, 2022 at 11:58amHi Kamran,
Thanks for your post!
For your code, I ran a quick test with the same code base and actually it works for me.
You mentioned that "when I click on the link in email, I am getting Unauthorized Access", it might because that you didn't resend the transaction after uploading the document:
ossClient.SendPackage(packageId);
Can you run anther test and let me know if the newly uploaded document appears in your admin portal?
For "once the package is completed we can not change the status back to Draft", it's as expected. You can only archive or trash a completed transaction, but not to put it back to draft. Please refer to below feature guide for the lifecycle of a transaction:
https://community.onespan.com/documentation/onespan-sign/guides/feature-guides/developer/retrieving-signing-status
Duo
Reply to: Add document to existing package
Monday, September 26, 2022 at 08:48pmHi Duo,
using ossClient.SendPackage(packageId); worked.
Now I am facing another issue, the second document which I attached later, requires signatrue
document.Signatures.Add(SignatureBuilder.SignatureFor("emailaddress")
.OnPage(0)
.AtPosition(175, 165)
.Build());
but the system is not asking for any signature on newly added document, I have attached the screen shot.
IS there anything which I am missing?
Thanks,
Kamran
Reply to: Add document to existing package
Tuesday, September 27, 2022 at 10:03amHi Kamran,
Can we make sure that the {emailaddress} already exists in this transaction?
Duo
Reply to: Add document to existing package
Wednesday, September 28, 2022 at 12:31amHi Duo,
Thanks that issue is resolved now.
Now we are trying to replace an existing document. The issue we are facing is, if the doucment is not signed then the system is replacing the document but if the document has already been signed then the system is not replacing the existing document.
The package is not completed yet as there are more documents to be signed but the existing one which is already signed is not being replaced.
we also tried with two signees on the same document, one signed the document then we replaced the document but the system is still showing the old one.
Do we have to delete the document and add a new one in this scanario?
Second question is, Is there a way to check the status of individual document, if it is completed or not?
Thanks,
Kamran