Script Execution on Excepetions Answered

Hi all,

This question is a follow up of this one here: The goal is the have a script fired after a document goes to Exception state. Currently the only workarounds for this case are exporting documents to folders and checking them with a third-party software (PRTG, Windows Service, etc.). This is a big overhead compared to scripts executed at specific stages within FlexiCapture.

I wrote the following SQL query to query the database for batches in exception state.

 b.[Name] as BatchName,
 p.[Name] as Stage,
 [dbo].[Batch] b left join
 [dbo].[ProcessingStage] p on b.[ProcessingStageId] = p.[Id]

 p.[Name] is null or p.[Name] IN ('Exceptions')

This script can be used to query the states without using the file system. I am still not satisfied and looking for a solution using the integrated scripting. Can someone point me in the right direction or should this be a feature request?



Was this article helpful?

0 out of 0 found this helpful



  • Avatar


    There are such tools as routing rules (entry and exit conditions) and additional stages in workflow that would have been useful for you if it was not the Exceptions stage you are interested in. 

    However, the Exceptions stage is special, because documents can be sent there by different ways, including manual sending. So we cannot guarantee that all documents that ended in Exceptions have passed through the rules/stages that trigger e-mail sending. 

    For this situation, querying the DB for the documents that are actually in the Exceptions is the most correct way.

    You may find more information about routing rules and additional workflow stages here:

    Appendix > Using scripts in ABBYY FlexiCapture > Scripts for customizing processing stages > Types of scripts > Stage rule script

    Program settings > Setup ABBYY FlexiCapture complex > Editing Stage Properties

  • Avatar

    Hi Ekaterina,

    Thanks for your response. Then my solution is the preferred way to go.


  • Avatar
    Sachin Bhutani

    Hi ,
    How do u get only new batches sent to exception from this query ? Or you send the entire exception batch list ?


Please sign in to leave a comment.