Search code examples
kofax

Get the Scan Operator when releasing documents


When releasing documents the scan operator should get logged to a file. I know this is a kofax system variable but how do I get it from the ReleaseData object?

Maybe this value is hold by the Values collection? What is the key then? I would try to access it by using

string scanOperator = documentData.Values["?scanOperator?"].Value;


Solution

  • Kofax's weird naming convention strikes again - during setup, said items are referred to as BatchVariableNames. However, during release they are KFX_REL_VARIABLEs (an enum named KfxLinkSourceType).

    Here's how you can add all available items during setup:

    foreach (var item in setupData.BatchVariableNames)
    {
        setupData.Links.Add(item, KfxLinkSourceType.KFX_REL_VARIABLE, item);
    }
    

    The following sample iterates over the DocumentData.Values collection, storing each BatchVariable in a Dictionary<string, string> named BatchVariables.

    foreach (Value v in DocumentData.Values)
    {
        switch (v.SourceType)
        {
            case KfxLinkSourceType.KFX_REL_VARIABLE:
                BatchVariables.Add(v.SourceName, v.Value);
                break;
        }
    }
    

    You can then access any of those variables by key - for example Scan Operator's User ID yields the scan user's domain and name.