Read the collection of object in script task

Hi Team,

I can read the process parameter of Business Process in script task if it is string or number in an "Implicitly typed variable - var" as below.

 

1.var _recipientEmails = Get("RecipientEmails");

2.var _totalRecords = Get("TotalRecords");

 

 

how could we read collection of records parameter as in the screenshot?

var _collectionRecords = Get<?>("ContactRecordCollection");

 

 

 

Regards,

Bhoobalan P.

File attachments
Like 0

Like

4 comments

Hi Bhoobalan, 

 

You are welcome to check a suitable solution by the link below: 

 

https://community.creatio.com/questions/use-script-task-update-column-r…

 

Get<ICompositeObjectList<ICompositeObject>> parameter should work for a collection of objects.

 

Regards,

Anastasiia

Anastasiia Markina,



Thanks. 


 

Hi,

I'm need to find the smallest price of a list of products. 

I get the list using the Read data element with the read collection of records mode.

In the script task I want to loop through all products and save the price if smaller than minPrice.

I created a process parameter with a type of Collection of records called: ProductsList and the value is set to the read element I mentioned above.

I have issue working with the collection.

I get the collection with the following script:

var productsList = Get<ICompositeObjectList<ICompositeObject>>("ProductsList");

foreach (var product in productsList)

{

      int price = ??????

       if (price<min)

            {

               min = price;

             }

}

 

I don't know how to continue on the foreach, how to get the price of the product.

I tried product.GetTypedColumnValue<int>("price"); 

but it doesn't work.

Can you please help me with this?

 

Thanks, 

Chani

 

I tried the following and it worked.

         if (item.TryGetValue<int>("UsrIntProductAcademicYear", out int value))

         {

             if(value<min);

             min=value;

         }

 

 

Show all comments