When executing the OpenScript
method of my release script I want to store the indexfields, batchfields and variables to lists. I created a snippet for this
Dictionary<string, string> indexFields = new Dictionary<string, string>();
Dictionary<string, string> batchFields = new Dictionary<string, string>();
Dictionary<string, string> kofaxValues = 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:
kofaxValues.Add(sourceName, sourceValue);
break;
case KfxLinkSourceType.KFX_REL_BATCHFIELD:
batchFields.Add(sourceName, sourceValue);
break;
}
}
}
I want to do this because I need the field value. Each field name is unique so I can use it as a key.
When storing my custom properties to the ReleaseSetupData
I can read them from the ReleaseData
. Let's say two custom properties would return me the field name and the field type, so I know that the field is an IndexField
and it's name is "MyIndexField".
I can use these information to access the Dictionary<string, string> indexFields
and get the value from that Indexfield
.
Currently I setup my ReleaseSetupData
with this code
releaseSetupData.CustomProperties.RemoveAll();
// Save all custom properties here
releaseSetupData.CustomProperties.Add("myCustomProperty", "fooBar");
releaseSetupData.Links.RemoveAll();
foreach (IndexField indexField in releaseSetupData.IndexFields) // Save all IndexFields
{
releaseSetupData.Links.Add(indexField.Name, KfxLinkSourceType.KFX_REL_INDEXFIELD, indexField.Name);
}
foreach (BatchField batchField in releaseSetupData.BatchFields) // Save all BatchFields
{
releaseSetupData.Links.Add(batchField.Name, KfxLinkSourceType.KFX_REL_BATCHFIELD, batchField.Name);
}
foreach (dynamic batchVariable in releaseSetupData.BatchVariableNames) // Save all Variables
{
releaseSetupData.Links.Add(batchVariable, KfxLinkSourceType.KFX_REL_VARIABLE, batchVariable);
}
When the OpenScript
method of my release script gets executed, the dictionaries (shown in the first snippet) stay empty. This is because documentData.Values
is empty.
How can I fill documentData.Values
?