Creating a Signing Workflow

When creating a document package (transaction in the ValidSign UI), you may have multiple signers required to sign several documents.

Accordingly, you may wish to control the flow of the signing ceremony. For example, as medical practitioner, you may require your patient to accept a consent form before signing a contract. With ValidSign, you can set the order in which multiple signers participate, and/or the order in which multiple documents are signed by a signer. 

Signer Workflow

Setting a Signing Order

The signer workflow determines the order in which multiple signers can participate in the signing ceremony. For example, a signer with a signing order 1 means that he/she will sign first. Hence, a signer with a given signing order can participate only after all signers with lower signing orders have completed signing. Also, two signers with the same signing order can sign documents simultaneously.

You can follow the code samples below to assign a signer workflow with the Java SDK, .NET SDK, and REST API. It covers how to edit the signer block in order to set a signer workflow. In the example, four signers are required to sign in succession. Furthermore, the second signer will receive a notification to sign the document only after the first signer has completed signing the document and so on and so forth. 

POST /api/packages

{
    "roles":
    [
        {
            "id": "role1",
            "index": 1,
            "type": "SIGNER",
            "signers":
            [
                {
                    "email": "signer1@example.com",
                    "firstName": "Firstname",
                    "lastName": "Lastname"
                }
            ],
            "name": "signer1"
        },
        {
            "id": "role2",
            "index": 2,
            "type": "SIGNER",
            "signers":
            [
                {
                    "email": "signer2@example.com",
                    "firstName": "Firstname",
                    "lastName": "Lastname"
                }
            ],
            "name": "signer2"
        },
        {
            "id": "role3",
            "index": 3,
            "type": "SIGNER",
            "signers":
            [
                {
                    "email": "signer3@example.com",
                    "firstName": "Firstname",
                    "lastName": "Lastname"
                }
            ],
            "name": "signer3"
        },
        {
            "id": "role4",
            "index": 4,
            "type": "SIGNER",
            "signers":
            [
                {
                    "email": "signer4@example.com",
                    "firstName": "Firstname",
                    "lastName": "Lastname"
                }
            ],
            "name": "signer4"
        }
    ]
}
.withSigner(newSignerWithEmail("signer1@example.com") 
   .withFirstName("Firstname") 
   .withLastName("Lastname")
   .signingOrder(1)) 
.withSigner(newSignerWithEmail("signer2@example.com")
   .withFirstName("Firstname") 
   .withLastName("Lastname") 
   .signingOrder(2)) 
.withSigner(newSignerWithEmail("signer3@example.com") 
   .withFirstName("Firstname") 
   .withLastName("Lastname") 
   .signingOrder(3))
.withSigner(newSignerWithEmail("signer4@example.com") 
   .withFirstName("Firstname")
   .withLastName("Lastname") 
   .signingOrder(4))
.WithSigner(SignerBuilder.NewSignerWithEmail("signer1@example.com") 
   .WithFirstName("Firstname") 
   .WithLastName("Lastname") 
   .SigningOrder(1)) 
.WithSigner(SignerBuilder.NewSignerWithEmail("signer2@example.com") 
   .WithFirstName("Firstname") 
   .WithLastName("Lastname") 
   .SigningOrder(2)) 
.WithSigner(SignerBuilder.NewSignerWithEmail("signer3@example.com") 
   .WithFirstName("Firstname") 
   .WithLastName("Lastname") 
   .SigningOrder(3)) 
.WithSigner(SignerBuilder.NewSignerWithEmail("signer4@example.com") 
   .WithFirstName("Firstname") 
   .WithLastName("Lastname") 
   .SigningOrder(4))
Editing your Signer Workflow

After you have created your transaction, you may wish to edit the signing order. In this example, the signing order of the first two signers are changed.

PUT /api/packages/{packageId}/roles

[
    {
        "id": "Signer2",
        "index": 0
    },
    {
        "id": "Signer1",
        "index": 1
    }
]
DocumentPackage afterReorder = eslClient.getPackage(packageId); 

afterReorder.getSigner("signer1@example.com")
   .setSigningOrder(2); 

afterReorder.getSigner("signer2@example.com")
   .setSigningOrder(1); 

eslClient.getPackageService().orderSigners(afterReorder);
afterReorder = eslClient.GetPackage(packageId);

afterReorder.GetSigner("signer2@example.com")
   .SigningOrder = 1; 

afterReorder.GetSigner("signer1@example.com")
   .SigningOrder = 2; 

eslClient.PackageService.OrderSigners(afterReorder);

Document Workflow

Setting a Document Order

The document workflow determines the order in which multiple documents are signed by a signer. By default, no document workflow is enforced. This allows a signer to freely browse all documents before signing them in any order. On the other hand, if a document workflow is enforced, the signer is presented with the document with the lowest signing order. Once that document is signed, the signer is presented with the document with the next lowest order, and so on and so forth.

You can follow the code sample below to assign a document workflow with the Java SDK, .NET SDK, and REST API. In the example, there are two documents in the package where one is required to be signed before the other. Also included in the guide is a sample code on how to update the document workflow after creating a package.

POST /api/packages

------WebKitFormBoundary1bNO60n7FqP5WO4t
Content-Disposition: form-data; name="file"; filename="testDocumentExtraction.pdf"
Content-Type: application/pdf
%PDF-1.5
%µµµµ
1 0 obj
<>>>
endobj.... 
------WebKitFormBoundary1bNO60n7FqP5WO4t
Content-Disposition: form-data; name="payload"
{
  "documents": [
    {
      "id": "Document1",
      "index": 1,
      "name": "First Document"
    },
    {
      "id": "Document2",
      "index": 2,
      "name": "Second Document"
    }
  ],
  "name": "Document work flow",
  "type": "PACKAGE",
  "status": "DRAFT"
}
------WebKitFormBoundary1bNO60n7FqP5WO4t--
.withDocument(newDocumentWithName("Second Document")
   .fromFile("your_file_path")
   .atIndex(2)
   .withExtractionType(ExtractionType.TEXT_TAGS)
   .enableExtraction())
.withDocument(newDocumentWithName("First Document")
   .fromFile("your_file_path")
   .atIndex(1)
   .withExtractionType(ExtractionType.TEXT_TAGS)
   .enableExtraction())
.WithDocument(DocumentBuilder.NewDocumentNamed("Second Document")
   .FromFile("your_file_path")
   .AtIndex(2)
   .WithExtractionType(ExtractionType.TEXT_TAGS)
   .EnableExtraction())
.WithDocument(DocumentBuilder.NewDocumentNamed("First Document")
   .FromFile("your_file_path")
   .AtIndex(1)
   .WithExtractionType(ExtractionType.TEXT_TAGS)
   .EnableExtraction())
Editing your Document Workflow

The sample code below shows you how to reorder the document workflow after you have created the package. If you've already sent your package to be signed, you will need to change its status to DRAFT before you can update the document workflow.

PUT /api/packages/{packageId}/documents

[
  {
     "id":"Document1",
     "index":2
   },
   {
     "id":"Document2",
     "index":1
   }
  }
]
DocumentPackage postOrderDocumentsPackage = eslClient.getPackage(packageId);

postOrderDocumentsPackage.getDocument("First Document").setIndex(2);
postOrderDocumentsPackage.getDocument("Second Document").setIndex(1);
 
eslClient.getPackageService().orderDocuments(postOrderDocumentsPackage);
DocumentPackage savedPackage = eslClient.GetPackage(packageId);

savedPackage.GetDocument("First Document").Index = 2;
savedPackage.GetDocument("Second Document").Index = 1;

eslClient.PackageService.OrderDocuments(savedPackage);