> ## Documentation Index
> Fetch the complete documentation index at: https://docs.abbyy.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Event handlers

> Event handler scripts in ABBYY FlexiCapture respond to batch, document, and field events, set up in batch type, project, or Document Definition properties.

FlexiCapture lets you create handlers for events that affect batches, documents and fields.

Event handlers are stored in batch types and Document Definitions. You can find their settings on the Event Handlers tab of the **Properties** dialog box of:

* *(Administrator)* [Batch Types](/flexi-capture/project-settings/batch-types-project-settings) *(Developer)* Batch Types ( *(Distributed)* for Document Definitions *(Standalone)* for specific batch types)
* *(Administrator)* [Projects](/flexi-capture/project-settings/project-properties) *(Developer)* Projects (for all batch types in the project except for those for which event handlers have been set up in batch type properties)
* *(Administrator)* [Document Definitions](/flexi-capture/templates/template-properties) *(Developer)* Document Definitions (for documents of the current type)

## Batch events

[After batch created](/flexi-capture/appendix/scripts/batch-creation)

[Before batch delete](/flexi-capture/appendix/scripts/batch-removal)

[Before batch parameter change](/flexi-capture/appendix/scripts/batch-modify)

[After page added](/flexi-capture/appendix/scripts/batchcontents-modify)

[Before page delete](/flexi-capture/appendix/scripts/batchcontents-modify)

[After document created](/flexi-capture/appendix/scripts/batchcontents-modify)

[Before document delete](/flexi-capture/appendix/scripts/batchcontents-modify)

[Before pages move](/flexi-capture/appendix/scripts/moving-pages)

[After batch opened](/flexi-capture/appendix/scripts/batch-opening)

[Before batch close](/flexi-capture/appendix/scripts/batch-opening)

[Batch integrity check](/flexi-capture/appendix/scripts/batch-integrity)

## Document events for batch types

These event handlers are set up in a batch's properties or in a batch type's properties.

[Before document parameter change](/flexi-capture/appendix/scripts/documentparam-change)

[After document state changed](/flexi-capture/appendix/scripts/documentstate-change)

[After export completed](/flexi-capture/appendix/scripts/script-afterexport)

[Before matching](/flexi-capture/appendix/scripts/before-matching)

## Document event for the current batch type

These event handlers are set up in a Document Definition's properties.

[Before document parameter change](/flexi-capture/appendix/scripts/documentparam-change)

[After document state changed](/flexi-capture/appendix/scripts/documentstate-change)

[After document rules are checked](/flexi-capture/appendix/scripts/after-check-rules)

Event handlers for fields can also be set up in a Document Definition's properties (see below).

## Field events

[Field verification request](/flexi-capture/appendix/scripts/field-verification-appendix-scripts)

<Note>
  If the same event handler is set up for batch types and the current document type, the event handler for the document will be executed first, followed by the event handler for batch types.
</Note>

<Accordion title="Storing procedures in global modules">
  We recommend adding procedures that you plan to use in several event handlers to a global module. To do this, select **Events** from the drop-down list on the toolbar of the script editor.

  <Note>
    Global modules are not available for event handlers in the Document Definition editor.
  </Note>
</Accordion>

<Accordion title="Adding external assemblies">
  If a script or a global module is using methods from an [external assembly](/flexi-capture/appendix/scripts/user-assembly), you can add this external assembly on the .NET References  tab of the properties dialog of an object (a batch type, a project or a Document Definition).
</Accordion>
