> ## 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.

# Stage rule

> Stage rules in ABBYY FlexiCapture decide whether a document can be routed to a workflow stage, returning results through the IRoutingRuleResult object.

## What it does

This script is used to determine whether the document can be routed to a certain stage. Applies in  *(Administrator)* [rule settings](/flexi-capture/project-settings/rule-settings) *(Developer)* rule settings in the Advanced mode of the  *(Administrator)* [Workflow setup](/flexi-capture/project-settings/workflow-project-settings) *(Developer)* Workflow setup.

If an error occurs during the script execution, the document will be sent to the Exceptions stage.

## Parameters

| **Name** | **Type**                                                                 | **Access** | **Description**                                 |
| -------- | ------------------------------------------------------------------------ | ---------- | ----------------------------------------------- |
| Document | [IDocument](/flexi-capture/appendix/scripts/idocument)                   | Read-only  | The document for which the check is carried out |
| Result   | [IRoutingRuleResult](/flexi-capture/appendix/scripts/iroutingruleresult) | Read/write | The result of the rule execution                |

Procedures that you wish to use in more than one rule should be written to the global rule module, which can be accessed from the script editor. From the drop-down list on the toolbar of the script editor, select **NonInteractiveProcessor**.

If classes and methods of an [external assembly](/flexi-capture/appendix/scripts/user-assembly) are used in the script or global module, the assembly file must be attached on the .NET References  tab of the  *(Administrator)* [batch type](/flexi-capture/project-settings/batch-types-project-settings) *(Developer)* batch type properties (for a particular batch type) or  *(Administrator)* [project properties](/flexi-capture/project-settings/project-properties) *(Developer)* project properties (for the Default batch type).

When a task is completed at the current stage the system determines what will be the next stage for this task. For this purpose the system estimates input conditions for further stages, for example, input scripting rules.
