RouteDocument
This event triggers when the system extracts a document.
Syntax
ScriptModule_RouteDocument (pWorkdoc as ISCBCdrWorkdoc, State as Single)
Parameter | Description |
---|---|
pWorkdoc | Workdoc object that was classified and extracted. |
State | This parameter contains the current state assigned to the workdoc. The value can be changed from script. |
Sample Code
Private Sub ScriptModule_RouteDocument(pWorkdoc as SCBCdrPROJLib.SCBCdrWorkdoc, State as Integer)
If pWorkdoc.Fields("Field1").Valid = FALSE then
'route to 500 if Field1 is not valid
State = 500
Exit sub
End if
If pWorkdoc.Fields("Field2").Valid = FALSE then
'route to 520 if Field2 is not valid
State = 520
Exit sub
End if
'else use default state
End Sub
For example, in an environment where the batch directory is shared between multiple organizations (either country groups, or departments), it is possible to allocate verifiers their own workflow configurations.
The following script automatically sets the batch status after extraction to a status that is country based (such as, GB is status 550, Germany is status 551).
Private Sub ScriptModule_RouteDocument(pWorkdoc as SCBCdrPROJLib.SCBCdrWorkdoc, State as Integer)
'If the batch state is 550 and document is not in verifier
If State = 550 And Not fnIsVerifier() Then 'Check country code and set batch status
Select Case CountryCode
Case "GB"
State = 550
Case "DE"
State = 551
Case "BENL"
State = 552
Case "IE"
State = 553
Case "RU"
State = 554
Case "US"
State = 555
Case Else
State = 550
End Select
'Save the work doc after changing document status
pWorkdoc.Save(pWorkdoc.Filename,"")
End If
End Sub