Skip to main content

How to perform Document Routing

Article # 3036862 - Page views: 353


How to perform Document Routing with KTM? How to perform Batch routing?

How to skip KTM validation module or queue while processing batch and all fields are valid after KTM Server?



Document Routing capability was introduced in KTM 5.0, and requires Kofax Capture 9.0 or higher. This article contains information current as of KTM 5.0. Please see the Scripting Help topic Configuring Batch Operations ¦ Routing Batches, Folders and Documents for new features added in KTM 5.5, such as routing folders or routing to a separate Batch Class.

You will find information about it here: KTM 6.4 help with samples,  KTM 6.3 help with samples


Use Case

  1. Exception Documents
    A Batch of 100 Documents contains 98 Documents that are valid after the KTM Extraction Server. The 2 invalid Documents cause the whole Batch to go to the KTM Validation module, which will 'hold up' the 98 Documents that are valid from being processed further. The invalid Documents can be routed to the Validation module and the valid Documents to the Export Connector.
  2. Document Types
    Once a Batch has been processed by the KTM Server, Document Routing can be used to split the Batch and send different Document types to different Validation modules.
    Screen Shot 2018-09-13 at 11.19.43 AM.png



Document Routing makes use of the following KTM XValues:

  2. KTM_DOCUMENTROUTING_BATCHNAME_<PlaceHolder> (Root XFolder Object) <PlaceHolder> = Child Batch or Target Batch.
  3. KTM_DOCUMENTROUTING_QUEUE_<Placeholder> (Root XFolder Object)
    THISBATCH = Parent Batch, i.e., the Batch that is going to be split, or rerouted.



  1. Child Batch definition
    XDocInfo.XValues.Set("KTM_DOCUMENTROUTING", <PlaceHolder>)
    This is the target Batch for Documents that are to be selected and placed in this Batch.
  2. Automatic/explicit Batch naming
    pXRootFolder.XValues.Set("KTM_DOCUMENTROUTING_BATCHNAME_" & <PlaceHolder>, sExplicitBatchName)
    This will give the child Batch an explicit name.
    Step 1 has be performed before Step 2.
  3. Child Batch routing
    pXRootFolder.XValues.Set("KTM_DOCUMENTROUTING_QUEUE_" & <PlaceHolder>, sModuleName)
    This will route the child Batch to the defined Kofax Capture module (sModuleName).
  4. Parent Batch routing
    pXRootFolder.XValues.Set("KTM_DOCUMENTROUTING_QUEUE_THISBATCH", sModuleNameOriginalBatch)
    If this step is not defined, then the parent Batch, if not empty, will be routed to the next queue that has been defined in the Capture Batch Class.
    If the parent Batch is empty it will automatically be removed from the Kofax Capture Batch Manager.

A combination of steps 1 to 4 can be applied depending on the use case:

  • Simple Batch splitting
  • Batch splitting, renaming and routing
  • No Batch splitting, but just Batch re-routing
Note-Icon.png Note: All Document Routing-related XValues are discarded after they have been applied.

The routing script should consider the module (Project.ScriptExecutionMode), instance (Project.ScriptExecutionInstance, 1-based integer), and Batch Close Mode (CscBatchCloseMode, used in the Batch_Close event) such as in this example:

Screen Shot 2018-09-13 at 11.24.47 AM.png

Batch Routing can be tested in the Project Builder.

Use the lightning icon configure option to define the Module ¦ Event ¦ Close Mode, and click on the lightening icon to execute the script:

Screen Shot 2018-09-13 at 11.25.08 AM.png

The following example code describes how Document Routing can be used:


This code is in the example project, which can be downloaded at the end of this article.

This is a screen shot of the KTM Validation in the example project provided below.

For each Document in the original Batch, a child Batch (sBatchTag, the target Batch or new Batch) can be defined, and in which queue (sModuleName, the KC/KTM module in the Batch Class queue) to which the new Batch should be routed:
Screen Shot 2018-09-13 at 11.25.57 AM.png

Level of Complexity 



Applies to  

Product Version Build Environment Hardware
Kofax Transformation Modules




Add any references to other internal or external articles


  • Was this article helpful?