sramos | Posts: 7

Add documents with template package

0 votes
Hi, I'm having problems with this funcionality, when I create eslPackage from template, I need add again the documents with "Upload method". The problem is that the Signers IDs doesn't caculated from me, I'm recieving the ids from template. How can i associate "Text Tags" id for example to a Signer with"replacing" function? Thanks

Approved Answer
Duo_Liang | Posts: 3776

Reply to: Add documents with template package

0 votes
Hi sramos, Following is the code snippet I created for you:
		//1. create package from template
		PackageId templateId = new PackageId("1vYZWzuPHBorYDTpHBp5b77FA3c=");
		
		DocumentPackage newPackage = PackageBuilder.newPackageNamed("create package from template - " + new Date(System.currentTimeMillis()))
				.build();

		PackageId packageId = eslClient.getTemplateService().createPackageFromTemplate(templateId, newPackage);
		
		System.out.println(packageId);
		
		
		//2. add an additional document
		Document document = DocumentBuilder.newDocumentWithName("personal contract")
				.fromFile("C:\\Users\\liangdu1\\Desktop\\work\\documents\\SampleDocTextTagsNew.pdf")
				.withExtractionType(ExtractionType.TEXT_TAGS)
				.enableExtraction()
				.build();
		eslClient.uploadDocument(document, packageId);

		
		//3. replace placeholder
		Signer placeholder = SignerBuilder.newSignerWithEmail("[email protected]")
				        .withFirstName("duo")
				        .withLastName("liang")
				        .withCustomId("0668c12c-5674-49dd-bd69-ab251a40f98a").build();
		eslClient.getPackageService().updateSigner(packageId, placeholder);
Tell me whether it works for you or any questions related to the code! Duo

mwilliams | Posts: 957

Reply to: Add documents with template package

0 votes
Hello sramos, So, you're only noticing this issue when you clone a template to create a transaction and then attempt to add additional documents to it using tags with Signer1, Signer2, etc.? Is this correct? Thanks,

sramos | Posts: 7

Reply to: Add documents with template package

0 votes
Yes, when I add a signer in the package, this is the steps: 1- I Fill the PackageBuilder with info, documents, signers and signatures. 2- I use the function "eslClient.getTemplateService().createPackageFromTemplate(TEMPLATE_ID, packageToBuild.build());" 3- I Re-Upload Documents, because dissapears from package object(I think that template replaces documents) The problem is that the IDs who I used to associate documents signatures with signers are not equal that the original package an I cant associate the seignatures from added documents.

sramos | Posts: 7

Reply to: Add documents with template package

0 votes
Anyone can help me in this topic? Thanks

Duo_Liang | Posts: 3776

Reply to: Add documents with template package

0 votes
Hey sramos, There's a way to add text tags with Role Name instead of Role ID, but before you follow this path, could you share more info to me? Could you extend "Re-Upload Documents, because dissapears from package object" a little bit? Did you mean that after calling PackageId packageId = eslClient.getTemplateService().createPackageFromTemplate(templateId, newPackage); and retrieving the package by its ID, the documents list was empty? Because the purpose of using template was to avoid uploading document again and to inherit all the document fields. You could also share your template ID, and your code snippet to facilitate the troubleshooting. Best, Duo

sramos | Posts: 7

Reply to: Add documents with template package

0 votes
Hi, I need to add a personal contract document for each transaction, and I use the template for store and use one big, and global formulary for all users. In the template, the signatures and form fields are associated to "Signer1" but when I want to read the new document and interpretate the signatures(Text tags) I cant relation the signature with the Signer role id because OneSpan set it for me. How can I use one Role for template documents and new documents with Text tags extraction.

Duo_Liang | Posts: 3776

Reply to: Add documents with template package

0 votes
Hey sramos, Thanks for sharing, now I understood your workflow. As I mentioned above, you don't need to use Role ID to match Text Tags, instead, use Role Name. At the same time, the Template Placeholder name "Signer1/2/3" OSS assigned for you also refers to the Role Name, so that you can locate the same role. Here's a documentation link for the Text Tags and its Syntax definition: {{Xesl[_fieldName]:roleName:fieldType[:parameter1,parameter2,...]}} So before coding, try this flow in your web dashboard: (1) Have a Template with a placeholder recipient "Signer1" (2) Create a new transaction from template (3) Before you "replace" the placeholder, upload document with Text Tags.(you can use my testing document in attachment) (4) After you replace the placeholder, all the signatures and fields should keep intact. Hope this could help! Duo

Attachments
sramos | Posts: 7

Reply to: Add documents with template package

0 votes
Hi sorry, but Im using the SDK application, do you have an example about creation package from template and adding a text tag extraction document? This is my code: )packageToBuild = OSS_PackageToBuild.withDocument(document) packageToBuild = OSS_PackageToBuild.withSigner(signer); ESL_PACKAGE_ID = ESL_CLIENT.getTemplateService().createPackageFromTemplate(TEMPLATE_ID, packageToBuild.build()); //If i remove this, the documents not upload to package for( DocumentBuilder db : documents ) { ESL_CLIENT.uploadDocument(db.build(),ESL_PACKAGE_ID); } Thanks!

sramos | Posts: 7

Reply to: Add documents with template package

0 votes
Hi, It's works! I have change my method for create the package. Before, I was using the function package.withDocument or with Signer, but now I have changed for updateSigner/uploadDocument. The concept that you explain me is that first I need to "inicializate" the package and next manipulate, before, I was creating the package with all inside and that is not complatible with template manipulations. Thanks!

Duo_Liang | Posts: 3776

Reply to: Add documents with template package

0 votes
Good to know that! Let us know if you have any other questions!

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