When OpenScript()
of the kofax release gets called I read all the Indexfields
, BatchFields
and BatchVariables
from the ReleaseData
object and store them to dictionaries.
Dictionary<string, string> indexFields = new Dictionary<string, string>();
Dictionary<string, string> batchFields = new Dictionary<string, string>();
Dictionary<string, string> batchVariables = new Dictionary<string, string>();
foreach (Value val in documentData.Values)
{
if (val.TableName.IsEmpty())
{
string sourceName = val.SourceName;
string sourceValue = val.Value;
switch (val.SourceType)
{
case KfxLinkSourceType.KFX_REL_INDEXFIELD:
indexFields.Add(sourceName, sourceValue);
break;
case KfxLinkSourceType.KFX_REL_VARIABLE:
batchVariables.Add(sourceName, sourceValue);
break;
case KfxLinkSourceType.KFX_REL_BATCHFIELD:
batchFields.Add(sourceName, sourceValue);
break;
}
}
}
documentData.Values
is empty. When debugging it with a loop
documentData.LogError("-------- SAVED VALUES --------");
foreach (Value val in documentData.Values)
{
documentData.LogError("######");
documentData.LogError(val.SourceName);
documentData.LogError(val.Value);
documentData.LogError("######");
}
I get no entry logged. Before calling the setup Apply
method I save all the data I want to access in the release.
releaseSetupData.CustomProperties.RemoveAll();
releaseSetupData.CustomProperties.Add("username", cobraService.Username);
releaseSetupData.CustomProperties.Add("password", cobraService.Password);
releaseSetupData.CustomProperties.Add("webserviceRootUrl", cobraService.WebserviceRootUrl);
releaseSetupData.CustomProperties.Add("templateId", selectedTemplateID.ToString());
releaseSetupData.Links.RemoveAll();
foreach (IndexField indexField in releaseSetupData.IndexFields)
{
releaseSetupData.Links.Add(indexField.Name, KfxLinkSourceType.KFX_REL_INDEXFIELD, indexField.Name);
}
foreach (BatchField batchField in releaseSetupData.BatchFields)
{
releaseSetupData.Links.Add(batchField.Name, KfxLinkSourceType.KFX_REL_BATCHFIELD, batchField.Name);
}
foreach (dynamic batchVariable in releaseSetupData.BatchVariableNames)
{
releaseSetupData.Links.Add(batchVariable, KfxLinkSourceType.KFX_REL_VARIABLE, batchVariable);
}
Important:
The data gets saved during setup because when opening the configuration a second time, I can access the data from previous configurations. When loading my form I could do
CustomProperties props = releaseSetupData.CustomProperties;
if (props.TryGetValue("username", out string username))
{
edtUsername.Text = username;
}
and get the previous configured value.
2018-12-21 08:54:20, 0x00000018, 0, 0x00000000, 0x00000000, 0x00000000, C:\Program Files (x86)\Kofax\CaptureSS\ServLib\Bin, Admin, WINPQQ02E45HKM:Sess 2, 11.0.0.0.0.397, , 130, The SetupData object could not be released while closing the script. ScriptName = Custom Export Script, Version=10.2, Reference Count = 3., ,
Is something wrong or missing?
User contributions licensed under CC BY-SA 3.0