Skip to main content
Kofax

CallingContext Define Where Validation Script Method is Executed

3023293

Question / Problem: 

Using CallingContext to determine whether a Validation Script method is executed in Kofax Capture, KFS Thin Client, or KFS MFP Client. 

Answer / Solution: 

The KFS Validation Script API uses the CallingContext enumerator to determine the context in which a method is executed.  The following are the valid values:

Value Description
KofaxCapture Method is executed in Kofax Capture
KofaxFrontOfficeServerWebClient Method is executed in the KFS Thin Client Indexing screen
KofaxFrontOfficeServerDevice Method is executed in the KFS MFP Client Indexing screen

 

In the following example from the CitiesSample C# Validation script, the pre-population of the City field choice list based on the value of the Country field is limited being performed only in KFS (both the MFP Client and Thin Client) without being performed again in Kofax Capture by scripting the method to not be performed in the KofaxCapture CallingContext:

// The action of this method will only be applied if it is being called from Kofax Front Office Server. If
// it is being called from the Kofax Capture Validation module, do nothing.
if (!(ValidationContext.GetCurrentContext(this.Country.IndexField.Document) == CallingContext.KofaxCapture))

 

The CallingContext can also be used to ascribe different behavior to different contexts.  In the following example from the CitiesSample C# Validation script, an MFP Client user is forced to select one of the predefined choice list items as the City field value.  However, a KFS Thin Client user is allowed to either select a predefined value or enter a custom value:

if (ValidationContext.GetCurrentContext(this.Country.IndexField.Document) == CallingContext.KofaxFrontOfficeServerDevice)
{
     //If they are using an mfp, the user must choose from the specified cities
     this.City.IndexField.SuggestedValuesForceMatch = true;
}
else if (ValidationContext.GetCurrentContext(this.Country.IndexField.Document) == CallingContext.KofaxFrontOfficeServerWebClient)
{
     //If they are using the KFS Web Client, the user can type in another city if they choose
    this.City.IndexField.SuggestedValuesForceMatch = false;
}

Applies to:  

Product Version
KFS 4.1
  4.3

 

 

  • Was this article helpful?