This article will look at how to use the results of a Read Data element in a Creatio process to create a comma-delimited list of the values in a single string. For this article, I’ll be reading contact records, then creating a comma-delimited list of their email addresses (with the idea that I can then use that to send an email to the contacts).
A read data element has a few different modes, one of them being to Read a Collection of Records. This is the mode we’ll need for this (the default mode only reads the first record that matches the conditions, we want all of them which is what the “read a collection of records” will provide). The collection of records is just like any collection of records in a process, see the previous article about using collections in processes:
Working With Collection Parameters in a Process Script Task in Creatio
A couple of setup items, we’ll need a text process parameter where we will put the comma-list of email addresses, in my sample I’ve named that EmailList. For the Read Data element, be sure it’s set to Read a collection of records (and obviously make sure it contains the column you’ll want, in my case the Email column)

The key to be able to get the actual collection from this read data element is to know what it’s name (Code) is. To get this, we’ll need to switch to Advanced mode of the Read data element

Then you can see the Code of the element:

Now, in the script task, we can access the results (the collection of records) from this Read Data element by using (note the Code/name of the read data element, in my case that name is “ReadDataUserTask1”):
var items = Get<ICompositeObjectList<ICompositeObject>>("ReadDataUserTask1.ResultCompositeObjectList");
From there, it’s just like working with any collection parameter. For my sample, I want to create a comma-delimited list of the email addresses for the contacts in the results. That code would look like the following:
var items = Get<ICompositeObjectList<ICompositeObject>>("ReadDataUserTask1.ResultCompositeObjectList");
var list = "";
// now loop through the objects returned by the read data element
foreach (ICompositeObject item in items)
{
if (item.TryGetValue<string>("Email", out string value))
{
if (list.Length > 0) list += ", ";
list += value;
}
}
Set("EmailList", list);
return true;
The end result would be a string of email addresses, such as “person1@email1.com, person2@email2.com, person3@email3.com” that would be placed in the text param in my process.




Is there any way to iterate over all keys in an ICompositeObject? I don’t believe there is, but would love to be wrong! I believe there would be if the object were actually a CompositeObject instead of an ICompositeObject, but unfortunately both Read Data steps and using the Transform extension method against an EntityCollection return by ESQ return an ICompositeObject. Are you aware of any way to get all the keys from one though?
I don’t believe so according to docs here: https://academy.creatio.com/api/netcoreapi/8.0.0/api/Terrasoft.Common.ICompositeObjectList-1.html
I don’t see anything that looks like that. There is a HasProperty to check if a property exists, but nothing that looks like if provides all properties/keys.