nehme | Posts: 153

Long time

0 votes
Hello, I have a template which is has a 47 documents inside it. when I am creating the Package based on this template it is taking long time to generate the document package. it is taking around 47 seconds to be generated. I have tried to do a work around to delete documents from the template before creating the package based on the template but this delete will delete the document from the template inside sandbox. Any Help or another trick to do it. Thanks

Approved Answer
Duo_Liang | Posts: 3776

Reply to: Long time

0 votes
Hi nehme, Thanks for sharing to me and all the people who would have that use case! And thanks for your contribution to our community! I would create some more delicate code shares and have a deeper test on that. Duo

Duo_Liang | Posts: 3776

Reply to: Long time

0 votes
Hi nehme, There's a workaround for selecting partial documents from Template to create a package. But it's only available for REST way I believe, your request JSON can be organized in this way:
{
  "name":"Package created from template through REST API",
  "status" : "DRAFT",
  "roles": [
    {
      "id": "be7452c8-3c1e-44c1-af60-17a4fa6180a4",
      "type": "SIGNER",
      "signers": [
        {
          "id": "sender",
          "firstName": "1.firstname",
          "lastName": "1.lastname",
          "email": "[email protected]"
        }
      ],
      "name": "sender"
    },
     {
      "id": "46e1b44e-0b55-418e-bf82-d586c68a2c8c",
      "type": "SIGNER",
      "signers": [
        {
          "id": "signer",
          "firstName": "2.firstname",
          "lastName": "2.lastname",
          "email": "[email protected]"
        }
      ],
      "name": "signer"
    }

  ],
  "documents":[
      {"id":"doc1 ID"},
      {"id":"doc2 ID"},
       ...
    ]

}
You can add as much documents as you want, just need the document ID. It's not available for SDK, because in SDK, your DocumentPackage object will be converted into ApiPackage object, while ApiPackage object don't have the information for documents. If you are willing to achieve this function with C# REST, I can share some sample codes for you. Duo

nehme | Posts: 153

Reply to: Long time

0 votes
Thanks for your answer. The issue is that I am using SDK c#, I am not using the REST API. Any solution for this? because for example I create the document based on the template than I remove the documents from the package which will take long time and clients can not afford such delay. It is so long time. Thanks

Duo_Liang | Posts: 3776

Reply to: Long time

0 votes
Hi nehme, Can you use REST API just for this one function? Because as mentioned above, in SDK, it seems there's no way to select partial documents. Duo

nehme | Posts: 153

Reply to: Long time

0 votes
Hello, Thanks for your answer. can you send me more sample codes how to use this. Thanks

nehme | Posts: 153

Reply to: Long time

0 votes
hello, Thanks for the example. While passing multiple document ids I am getting the below error: Package Id: {"technical":"Multiple entries with same key: U0qSkBIhWg4V=com.silanis.esl.api.model.Field@76df0b47 and U0qSkBIhWg4V=com.silanis.esl.api.model.Field@5fe76829","messageKey":"error.internal.default","message":"Unexpected error. We apologize for any inconvenience this may have caused you, please try again. If the problem persists, please contact our support team.","code":500,"name":"Unhandled Server Error"} Please let me know what is wrong. Thanks

Duo_Liang | Posts: 3776

Reply to: Long time

0 votes
Hi nehme, Have you tried choose different document ids calling this function to see whether it's the code's problem or the document problem? It seems in your templates, there are two fields with the same id "U0qSkBIhWg4V". Can you narrow down the potential problem document and retrieve the template info for them in postman? Duo

nehme | Posts: 153

Reply to: Long time

0 votes
Hello, Thanks for your answer. But how I can have two fields with the same id “U0qSkBIhWg4V”? I have created the template from sandbox designer and upload the documents.

nehme | Posts: 153

Reply to: Long time

0 votes
Honestly, using SDK C# is better and more dynamic and lot of features and easy to handle. I hope you can find a workaround or a way to enhance the performance while creating the document from a big template which consist of more that 30 document. Thanks

nehme | Posts: 153

Reply to: Long time

0 votes
Thanks for your example. How I can use same example in addition fill fields data inside each document. Can you please send me the example how to do this. Thanks

Duo_Liang | Posts: 3776

Reply to: Long time

0 votes
Hi nehme, Sure, with my pleasure. Just want to make sure, you mean you are using Text Injection with PDF fields and want to inject different values when creating Package from Templates, right? Duo

nehme | Posts: 153

Reply to: Long time

0 votes
Yes 100% correct. Thanks :)

nehme | Posts: 153

Reply to: Long time

0 votes
hello, Any update? Thanks

Duo_Liang | Posts: 3776

Reply to: Long time

0 votes

Hi nehme, Unfortunately, from previous thread, Field injection only works during document upload because that's the only time where the application processes the document. So when cloning a package from Template, our application won't process the document again and it's impossible to inject fields on an existing document in a template. Duo


nehme | Posts: 153

Reply to: Long time

0 votes
hello, Thanks for your answer. The issue with SKD .net is that I am looping through all the fields related for a signature related for a document it is taking long time. See below my code: DocumentPackage myPackageAfterDelete = eslClient.GetPackage(packageId); for (int x = 0; x = myPackageAfterDelete.Documents.Count - 1; x++) { currDoc = myPackageAfterDelete.Documents[x]; //docId = currDoc.Id; for (int m = 0; m = currDoc.Signatures.Count() - 1; m++) { //sigId = currDoc.Signatures[m].Id; if (currDoc.Signatures[m].Fields.Count() != 0) { for (int y = 0; y = currDoc.Signatures[m].Fields.Count() - 1; y++) { currField = currDoc.Signatures[m].Fields[y]; if (String.IsNullOrEmpty(currField.Value)) { if (currField.Style != "UNBOUND_RADIO_BUTTON" || !String.IsNullOrEmpty(currField.Style)) { currField.Value = currField.Id;//y.ToString(); //eslClient.ApprovalService.ModifyField(packageId, docId, sigId, currField); eslClient.ApprovalService.ModifyField(packageId, currDoc.Id, currDoc.Signatures[m].Id, currDoc.Signatures[m].Fields[y]); } } } } } } to modify fields, it is taking long time. Any another way to do it? Is my way is correct? Thanks What I am doing is updating the fields values which already available in the documents from the template.

Duo_Liang | Posts: 3776

Reply to: Long time

0 votes
Hi nehme, For the first glance, every time you modify a field, you are sending a put request, that's why it takes so much time. And you got a triple-nested loop which is not a indicator from my knowledge. Can you tell me more about your use case and we can find out a better way to do that? Duo

nehme | Posts: 153

Reply to: Long time

0 votes
thanks for your answer. ok the case I am trying to solve is: 1. I have a template has inside it 40 pdfs (each pdf can have multiple pages) 2. Each pdf has a lot of text fields and lables fields to be filled while creating the package. 3. this is why I am using 3 loops, first loop to loop for each document i have, second loop, to loop inside the document to get the signer, third loop to get the fields and updated for the signer. This is my case, if there any better way? Please let me know about it, I will be happy to use it. Thanks So how I can update all the fields inside the created package from the template ? I did this based on your example https://developer.esignlive.com/code-share/push-data-fields-creating-package-template-net/

Duo_Liang | Posts: 3776

Reply to: Long time

0 votes
Hi nehme, If your concern is to create a package with so many documents(with all kinds of fields) and to save time, you shouldn't store them in a Template. If you just create a package from scratch, it would spend less time and more flexible as you can inject text fields and label fields at one time when you create them. If you need, I can create some sample code for you. Duo

nehme | Posts: 153

Reply to: Long time

0 votes
Hello, Thanks for your answer. but our forms has many places to add fields which is not easy to do it and I do not know what the positions to to put, using template is easier to place the fields. in addition, please send me sample code you mentioned it. Thanks

Duo_Liang | Posts: 3776

Reply to: Long time

0 votes
Hi nehme, Please have a check of our Document Extraction Feature. You just need some PDF fields with their name following our ESL programmar. Duo

nehme | Posts: 153

Reply to: Long time

0 votes
Thanks for your answer. in my case, all our documents has around 1500 fields. Which is template is so helpful for us. in your code sample you send me to use Rest API can while creating the package based on templates and include the documents i want, I can update the fields inside my documents? I do not want to add fields, I want to update the value for the fields. Did you get what I want to do? Thanks

Duo_Liang | Posts: 3776

Reply to: Long time

0 votes
Hi nehme, Yes, I understand your situation. But the problem is, when creating a package from a Template, you can't update the field value directly, which means you have to loop through all of them and in each iteration you need to make a put call, which could make more than 1500 calls each time you create a package (there's no way to do them in one call). That's strongly not recommended as it would add too much pressure on our system. On the other hand, you can have all these fields in the way follows Document Extraction, and when creating your package, you only need one call to update them all but only issue is the request payload is long. But it still much better than create 1500 calls but short. Duo

nehme | Posts: 153

Reply to: Long time

0 votes
Hello, I understand your answer. But the case I have it that I have multiple documents, this is why I am using the template. It is not a one PDF file with multiple pages. The template will give us the flexibility to delete the documents not needed and show only needed documents. Also, please not not all the fields to be updated. the worst case which we need to update max 100 fields in the whole package created from the template. This is what I am telling you about. That is why template is the best case for us. In addition, even i have 40 documents inside the template, max only i need to create a package based on 5 documents from this template which will have max 100 to 120 fields only to be updated.

Duo_Liang | Posts: 3776

Reply to: Long time

0 votes
Hi nehme, If you want to use WebUI to create your fields(which can be easier to design the document) and to select partial documents to combine a new package and you need to update your fields(or use fields injection to modify the content of document), I got a workaround for you. The main idea of this is, every time you create a package, you don't clone it directly from the template, you grab the package object from your template, and combine a new package using the template object through your code(you got all the fields information you want and you got the flexibility to update fields). If you think it's worth a try, I could create some sample codes for you. Duo

nehme | Posts: 153

Reply to: Long time

0 votes
Thanks for your answer. Please send me the sample codes for your work workaround. this will be SDK C# sample code. Thanks I will try it and update you. Thanks

Duo_Liang | Posts: 3776

Reply to: Long time

0 votes
Hi nehme, The attachment is the code sample I created for you. It just shows you the brief idea of the whole process. If you think it works for you, you can build delicate functions to match your values of injected fields to the document. (From my understanding, if you can use field injection to modify PDF, you don't need to update labels any more, right?) Duo

nehme | Posts: 153

Reply to: Long time

0 votes
Thanks for your answer. I am getting the below error: Silanis.ESL.SDK.EslException HResult=0x80131500 Message=Could not create a new package one step. Exception: Object reference not set to an instance of an object. Source=Silanis.ESL StackTrace: at Silanis.ESL.SDK.Services.PackageService.CreatePackageOneStep(Package package, ICollection`1 documents) at Silanis.ESL.SDK.EslClient.CreatePackageOneStep(DocumentPackage package) at LasteSign.Program.Main(String[] args) in C:\Users\nroukos\source\repos\LasteSign\LasteSign\Program.cs:line 64 Inner Exception 1: NullReferenceException: Object reference not set to an instance of an object.

Duo_Liang | Posts: 3776

Reply to: Long time

0 votes
Hi nehme, Can you share the code you are using and please remove all the sensitive information? Duo

nehme | Posts: 153

Reply to: Long time

0 votes
private static String apiUrl = "https://sandbox.esignlive.com/api"; private static String apiKey = "api key"; private static String packageId = "template id"; //template ID private static String roleID = "315e2f62-9fc7-43ff-a1ef-dca811e93a1f"; static void Main(string[] args) { EslClient eslClient = new EslClient(apiKey, apiUrl); DocumentPackage template = eslClient.GetPackage(new PackageId(packageId)); List documentList = new List(); documentList.Add("NAAF_en"); documentList.Add("W-8BEN"); documentList.Add("Declaration of Tax Residence"); documentList.Add("EFT"); documentList.Add("TFSA Application - English"); PackageBuilder pb = PackageBuilder.NewPackageNamed("package created from template " + DateTime.Now.ToString("HH:mm:ss tt")) .WithSigner(SignerBuilder.NewSignerWithEmail("[email protected]").WithCustomId(roleID).WithFirstName("N").WithLastName("R")); foreach (var curDoc in template.Documents) { if (documentList.Contains(curDoc.Name)) { DocumentBuilder db = DocumentBuilder.NewDocumentNamed(curDoc.Name).WithId(curDoc.Id).EnableExtraction(); //.FromFile("...\\6pages.pdf"); // you can write your own matching logic here List signatureList = curDoc.Signatures; foreach (var signature in signatureList) { //Debugger.Log(1, "Debug", signature.IsPlaceholderSignature() + "\n"); db.WithSignature(signature); } //inject fields db.WithInjectedField(FieldBuilder.TextField().WithName("First_Name").WithValue("N")); db.WithInjectedField(FieldBuilder.TextField().WithName("Last_Name").WithValue("R")); db.WithInjectedField(FieldBuilder.TextField().WithName("SIN").WithValue("4123")); db.WithInjectedField(FieldBuilder.TextField().WithName("Phone").WithValue("111-124/1247")); pb.WithDocument(db); } } DocumentPackage package = pb.Build(); PackageId packageID = eslClient.CreatePackageOneStep(package); eslClient.SendPackage(packageID);

Duo_Liang | Posts: 3776

Reply to: Long time

0 votes
Hi nehme, Can you hard code the file path for the documents? As when you create a package, the number of the files should match your entities in JSON payload.(number of Document Object) Duo

nehme | Posts: 153

Reply to: Long time

0 votes
Hello, but by using your code, i can not inject text in the fields as it was created in the template. In your code, I have to have the PDF forms locally. So means I have to create PDF forms for my my documents, so what is the use of template here?? I have already created template with fields inside it Thanks.

Duo_Liang | Posts: 3776

Reply to: Long time

0 votes
Hi nehme, As you noticed, the value attribute of Field has both get and set function which means you can modify it as the following snippet:
List signatureList = curDoc.Signatures;
foreach (var signature in signatureList) {
       List fieldList = signature.Fields;
       foreach (var curField in fieldList) {
               curField.Value = "xxx";
       }
      db.WithSignature(signature);
}
But honestly, in this way, as the label field is binded to the approval , it's harder for you to update them. While with text injection(with your local PDF forms), it's a document level field, which is easier for you to update. Duo

nehme | Posts: 153

Reply to: Long time

0 votes
Hello, PERFECT! :):):) This is what I am looking for and solved my problem. THANKS!!! Last question, How i can remove the (Electronic Disclosures and Signatures Consent) while creating the package? Really, very appreciated all your help and support :). Thanks!

Duo_Liang | Posts: 3776

Reply to: Long time

0 votes
Hi nehme, If you never want your default-consent to appear, I believe you should actually be able to contact support at [email protected] and have them turn it off for your account. I think it's an account level setting and can't be setting in specific packages. Duo

Duo_Liang | Posts: 3776

Reply to: Long time

0 votes
And so glad that you find the better way to achieve your goal. Just for my curiosity, is it a better idea to grab the template and update all fields at your side? How does the performance? Can you share a little bit to me? Duo

nehme | Posts: 153

Reply to: Long time

0 votes
Sure, Yes it is a better idea to grab the template and update all fields at your side. I will tell you why, because I am still using the concept of template and compose the fields and put them in the positions I want easy to handle. In addition, everything is packed so locally I pass the documents I want to use from my template and generate my package. This solution it is very effective for all your users who have lot of documents and fields inside the template. So get template id create package, inject the text fields, repack again finally build it and sent it. For example, I have a template which have 34 documents, each each document has 1 to 3 pages. the documents have a lot of fields. Performance Wise: 1. to generate a package (only one document) based on the latest code you sent, it took 4 seconds instead of 2.25 mins. to generate a package consists of 9 documents (multiple pages and fields) from the same template took 26 seconds instead of 4 mins. This method it is so dynamic because I am calling your PORTAL only 2 times, one time to get the package id for the template. second call to create the package after I compose all the fields and documents which is done offline. It is a great solution, really thanks

nehme | Posts: 153

Reply to: Long time

0 votes
Hi Duo, I want to check with you about the same case I have. Do I have facility to check which document has been signed and documents not signed inside the same package. Suppose, I sent the package to be sent, the Signer only sign one page, can I know which page he signed from the package? Thanks

Duo_Liang | Posts: 3776

Reply to: Long time

0 votes
Hi nehme, Yes, you can have the capability to check signing status, here's the guidance. But the search grain is only to the specific signer and specific document, which means you won't be able to know which page your signer has/hasn't signed. With Silanis.ESL.SDK.SigningStatus signerStatus1 = eslClient.GetSigningStatus(packageId, signerId1, docId1);, you can loop through your documents and grab the signing status of all your docs. Hope this could help you! Duo

nehme | Posts: 153

Reply to: Long time

0 votes
Hi Duo, Great! This is what I want. Thanks! I want to check with you about callbackURL and how to use it? If you can please provide me with more details about it and sample codes how to use it, it will be very helpful. Thanks!

Duo_Liang | Posts: 3776

Reply to: Long time

0 votes
Hi nehme, With callback URL registered in OSS, every time when an event happens (i.e. transaction completed, attachment uploaded, etc.), a notification is sent in the form of an HTTP POST request to the registered URL. If you want to set this URL, it can be modified in your Web UI portal in "Admin" dashboard. You can also have a check on this blog eSignLive How To: Creating a Callback Event Notification Listener if you need some sample code in C#. Following are some examples of the payload in the HTTP POST request OSS would send to you:
Create a new Package:
{"@class":"com.silanis.esl.packages.event.ESLProcessEvent","name":"PACKAGE_CREATE","sessionUser":"18EZDL44xgsX","packageId":"wVdZEaPD2igwUnFGJBjDD0dpO7k=","message":null,"documentId":null,"createdDate":"2018-06-30T20:04:55.384Z"}

Send a package
{"@class":"com.silanis.esl.packages.event.ESLProcessEvent","name":"PACKAGE_ACTIVATE","sessionUser":"18EZDL44xgsX","packageId":"5n4obeO8jYoPp126Cm-Y3fxdfbo=","message":null,"documentId":null,"createdDate":"2018-06-30T20:09:50.425Z"}

Signer 1 accept consent document
{"@class":"com.silanis.esl.packages.event.ESLProcessEvent","name":"DOCUMENT_SIGNED","sessionUser":"44aafb7c-97b9-40e1-bb59-eb76c7d2a484","packageId":"5n4obeO8jYoPp126Cm-Y3fxdfbo=","message":null,"documentId":"default-consent","createdDate":"2018-06-30T20:10:51.002Z"}

Signer 1 sign a signature block
{"@class":"com.silanis.esl.packages.event.ESLProcessEvent","name":"DOCUMENT_SIGNED","sessionUser":"44aafb7c-97b9-40e1-bb59-eb76c7d2a484","packageId":"5n4obeO8jYoPp126Cm-Y3fxdfbo=","message":null,"documentId":"7caf46cdd75f7a411bf8c22793b84fa79d8d180becc40691","createdDate":"2018-06-30T20:12:12.256Z"}

Signer 1 finish his part
{"@class":"com.silanis.esl.packages.event.ESLProcessEvent","name":"SIGNER_COMPLETE","sessionUser":"44aafb7c-97b9-40e1-bb59-eb76c7d2a484","packageId":"5n4obeO8jYoPp126Cm-Y3fxdfbo=","message":null,"documentId":null,"createdDate":"2018-06-30T20:12:12.272Z"}

Package Complete:
{"@class":"com.silanis.esl.packages.event.ESLProcessEvent","name":"PACKAGE_COMPLETE","sessionUser":"e00696ec-d6f5-4feb-89c5-a5ce002a6c66","packageId":"5n4obeO8jYoPp126Cm-Y3fxdfbo=","message":null,"documentId":null,"createdDate":"2018-06-30T20:15:01.038Z"}

Signer 1 opt out:
{"@class":"com.silanis.esl.packages.event.ESLProcessEvent","name":"PACKAGE_OPT_OUT","sessionUser":"b5381b13-991e-4179-9f9b-d4e1ec9d06bb","packageId":"J5tyJalzG49hmDho5b9JdG61T7M=","message":"the personal info is not correct","documentId":null,"createdDate":"2018-06-30T20:16:29.763Z"}
If you need other information about the event notification, just tell us! And we can talk about that in another new thread. :) 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