Error in Script in business process for reading multiple records
Hello,
I tried the script task to read multiple records as below:
EntityCollection entities = Get("MyEntity");
var result = new Collection();
foreach(Entity entity in entities) {
var productName = entity.GetTypedColumnValue("Name");
string temp = productName.ToString();
result.Add(temp);
}
string displayValue = result.ConcatIfNotEmpty(",");
Set("UsrLatestOrderProduct", displayValue);
return true;
But, here I'm getting below errors:
Like
Dear Riddhi,
The issue happened due to the incorrect using of generic methods (Get<T> and GetTypedColumnValue<TResult>) and generic type (Collection<T>). In order to resolve the issue you should add the type argument for every generic construction in the code. Please see the example of the code:
EntityCollection entities = Get<type>(“MyEntity”);
var result = new Collection<type>();
…
var productName = entity.GetTypedColumnValue<string>(“Name”);
Please find additional information in the article by the link below:
https://academy.creatio.com/documents/technic-bpms/7-15/script-task-process-element
Best regards,
Norton