Skip to main content
Kofax

Error when setting Validated Flag in DocPreProcessing event

16897

QAID # 16897 Published 

Question / Problem:

When I attempt to set the Validated Flag in a Document in the DocPreProcessing event, an error results.

In SBL, executing the following:

KfxACMDocument.Validated = True

Shows an error similar to:

"sending the batch to Quality Control due to the following error: [ SimpleDoc, KfxDocPreProcess ] Script returned fatal error."

In VB.NET, executing the following:

e.Document.Validated = True

Shows an error similar to:

"Script Error: [ C:PROGRA~3\Kofax\Capture\Local\scripts\00000027\SimpleDoc\bin\SimpleDoc.dll ] The application is busy. The operation was ignored."

Answer / Solution:

There is a timing issue in recent versions of Kofax Capture where this error can be returned when attempting to set certain properties in a Document because it is not fully loaded at DocPreProcessing event time.

Unfortunately, there is no workaround in a SBL Validation Script.

However in a VB.NET Script, a Timer object can be implemented as follows:

Namespace TestDoc1
    <SuppressFieldEventsOnDocClose(false)> _
    Public Class TestDoc1
        Inherits DocumentValidationScript
        <IndexFieldVariableAttribute("Name")> _
        Dim WithEvents Name As FieldScript
        <IndexFieldVariableAttribute("Address")> _
        Dim WithEvents Address As FieldScript
        Dim WithEvents Timer1 As System.Timers.Timer
        Private Sub TestDoc1_DocumentPreProcessing(sender As Object,
                e As Kofax.AscentCapture.Scripting.PreDocumentEventArgs)
                Handles Me.DocumentPreProcessing
            Timer1 = New System.Timers.Timer
            Timer1.Interval = 500
            MsgBox("Validated = " & e.Document.Validated.ToString())
            Timer1.Enabled = True
        End Sub
        Private Sub Timer1_Elapsed(sender As Object,
                e As System.Timers.ElapsedEventArgs) Handles Timer1.Elapsed
            Timer1.Enabled = False
            Name.IndexField.Document.Validated = True
            MsgBox("Validated = " & Name.IndexField.Document.Validated.ToString())
        End Sub
    End Class
End Namespace

Applies to:

Product Version
CAPTURE 10.0
  10.1
  10.2
  11.0