Fill in Label Field after Transaction Created from Template

0 votes

I have a transaction I'm creating in C# based on using at template.  The consent agreement and document to be signed are in the template.  I can create the transaction from the template no problem, but once it's created i want to update the value of a label field that's in the first document (after the Consent Agreement).  The label field is named "AccountNum".  All the transactions are "the same" but a couple fields need customized values.  Is there any easy way to do this?

Richard DeMello

Approved Answer

Reply to: Fill in Label Field after Transaction Created from Template

0 votes

Hi Richard,


Thanks for your post!

I would suggest to use this API (PUT /api/packages/{packageId}/documents/{documentId}/approvals/) to update all the fields under one signature in bulk. Below is some code snippets in Java SDK which is very similar to .Net code: 

        //create a package out of the template
        PackageId templatePackageID = new PackageId("GbstM-DP5mB7hC0xdDZ2wvc1uW4=");

        DocumentPackage newPackage = PackageBuilder.newPackageNamed("Transaction created out of a Template")
            .describedAs("Test Form")
            .withSigner(SignerBuilder.newSignerWithEmail("[email protected]")
        PackageId pkgId = eslClient.createPackageFromTemplate(templatePackageID, newPackage);
        //inject field
        HashMap<String, String> fieldValues = new HashMap<String, String>(){{
            put("FirstName", "John");
            put("LastName", "Smith");

        DocumentPackage createdPackage = eslClient.getPackage(pkgId);
        Document document = createdPackage.getDocument("AddressForm");
        for (Signature signature : document.getSignatures()) {
            boolean isUpdate = false;
            for(Field field : signature.getFields()) {
                if(fieldValues.containsKey(field.getName())) {
                    isUpdate = true;
            if(isUpdate) {
                eslClient.getApprovalService().modifySignature(createdPackage, document.getId().getId(), signature);


        //send package


The same logic can be applied to Restful API code as well. Please let me know if this works for you and if you need to me create some other sample codes.



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