Batch

The Batch (CscScriptBatch) object is the core object in script to that all batch related events and batch related operations like Batch Restructuring are attached. It is available in the project and the root folder script sheet and can be addressed by Batch.

The events of the Batch object are available in the project script sheet and can be divided into events that are available for every module that supports scripting and those that are only related to user interaction during batch editing.

In the following image, the events are shown that are available for most modules and that allow batch handling customization. The Batch_InteractiveClosing event is not available for server modules. It is available only for user interactive modules. The user interactive modules that support this event are Document Review, Validation, Verification, Thin Client Validation, or Thin Client Verification


An image that shows the Batch event sequence

This sequence can be expected for every user interactive module. To distinguish the executing module in these shared events please use the property Project.ScriptExecutionMode and if applicable the property Project.ScriptExecutionInstance for getting the information about the running instance of the module.

Application_InitializeBatch Event

The first event is not an event that is attached to the Batch object but is initializing its processing, it is attached to the Application object that is also defined on the project script sheet. In the Application_InitializeBatch event the script has read-only access to the given root XFolder object. In those events no changes to the batch structure or to the root XFolder are allowed, but initializations that are batch related can be applied and batch properties can be read. The Application_InitializeBatch event is thrown multiple times for parallelized server processing and is dependent of the number of Server threads that are running independently on that batch.

Batch_Open Event

The Batch_Open event is thrown only once per module and per batch and provides an extended access to the batch object that allows Batch Restructuring, this is also true for the parallelized server processing.

Batch_Close Event

When a batch gets closed in any module the Batch_Close event is fired once per batch and provides extended access to the batch object that allows Batch Restructuring. This is also true for the parallelized server processing.

Batch_InteractiveClosing Event

When a batch gets closed during a user interactive module (Document Review, Validation, Verification, Thin Client Validation, or Thin Client Verification) then the Batch_InteractiveClosing event gets fired once. This event can be used to stop a user from closing a batch. The batch object can be accessed by the pXRootFolder parameter that is read-only in this event and cannot be modified.

It has also a closeMode parameter with possible values of CscBatchCloseSuspend, CscBatchCloseError, and CscBatchCloseFinal. Another parameter called bCancel can be set to true to cancel the closing of the batch. Finally, the sMessage parameter can be configured to contain text that will be shown as user information to explain why the closing of the batch was cancelled.