Return fields for a specific document

0 votes
Hi, We are currently using the UI to create the package, inject the fields, then use the Java SDK API to download the documents.  I found this below which retrieves a list of field values at the package level.  But we are looking in a way to retrieve the fields by documents.   eslClient.getFieldValues(packageId) Using this function below, it does not return the fields and values.  Can you please let me know if there is a function that can return the fields and values for a specific document? document.getInjectedFields(); 

Reply to: Return fields for a specific document

0 votes
Hi there, Field Values SDK/API can only return you field values of all documents. So if you don't want that, alternatively, you can first get your document object and then loop through all signatures and all fields like below code does:
String documentName = "cleaning_contract";
Document document = eslClient.getPackage(packageId).getDocument(documentName);
		for (Signature signature : document.getSignatures()) {
			for (Field field : signature.getFields()) {
				System.out.println(field.getStyle() + " : " + field.getId() + " : " + field.getName() + " : " + field.getValue());
BTW, the injectedFields attribute will only be set and used in Field Injection Use Case, so this function won't work for you. Hope this could help! Duo

Duo Liang OneSpan Evangelism and Partner Integrations Developer

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