Dear sir, madam,
I have been troubleshooting this for a few hours and it is very frustrating. In one process it does work, in another it doesnt.
Apparently I found the problem, I am not sure if this is a bug of somesorts?
The following script is an example from: https://academy.creatio.com/docs/8-0/user/bpm_tools/process_elements_re…
var list = new CompositeObjectList<CompositeObject>();
var item1 = new CompositeObject();
item1["Id"] = Guid.NewGuid();
item1["Name"] = "Name1";
list.Add(item1);
var item2 = new CompositeObject();
item2["Id"] = Guid.NewGuid();
item2["Name"] = "Name2";
list.Add(item2);
Set<CompositeObjectList<CompositeObject>>("CompositeObjectListParameter", list);
I get the following error message
System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
at System.ThrowHelper.ThrowKeyNotFoundException()
at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at Terrasoft.Core.Process.ProcessParameterProvider.SaveCollection(String parameterPath, ICompositeObjectList`1 items)
at Terrasoft.Core.Process.ProcessParameterProvider.SetParameterValueInternal[TValue](String parameterPath, TValue value, Boolean setMustReadFromParameterStore)
at Terrasoft.Core.Process.ProcessParameterProvider.UpdateParameterValue[TValue](String parameterPath, TValue value)
at Terrasoft.Core.Process.ProcessParameterProvider.SetParameterValue[TValue](ProcessSchemaParameter parameter, Guid schemaElementUId, TValue value)
at Terrasoft.Core.Process.ProcessModel.SetParameterValue[T](FoundParameterData result, T value)
at Terrasoft.Core.Process.ProcessModel.TrySetValue[T](ProcessSchema processSchema, String propertyPath, T value)
at Terrasoft.Core.Process.ProcessModel.Set[T](String propertyPath, T value)
at Terrasoft.Core.Process.UsrProcess_0ca90bfCustom1MethodsWrapper.ScriptTask1Execute(ProcessExecutingContext context)
at Terrasoft.Core.Process.ProcessScriptTask.InternalExecute(ProcessExecutingContext context)
at Terrasoft.Core.Process.ProcessFlowElement.ExecuteItem(ProcessExecutingContext context)
at Terrasoft.Core.Process.ProcessFlowElement.Execute(ProcessExecutingContext context)
It only works when inserting the Collection of Records "CompositeObjectListParameter" parameters Id and Name into a subprocess.
If you do not 'connect' a subprocess it gives the error message.
Why is this? Is this a bug?