Append is not a valid operation inside a StartIteration/EndIteration block.

Append is not a valid operation inside a StartIteration/EndIteration block.

  

Hello,

I am creating recordlist from the result of an aggregate. For that I am iterating through foreach loop of result set of an aggregate.

I am getting this error.

This is the logic 


Please advice.

Thanks and Regards,

Suraj Borade


Hi Suraj,

I am guessing you trying to append record in list which you are using in for-each loop.

If still problem not solved please attach oml.


Regards

SK


Hi Suraj,

If you are trying to append\remove a record in the same list you are iterating on it will give you error and this is because the length of the list has decided when you start the iteration .



Regards

-PJ-

Yeah, what Sashi and Pramod said. Mutating a list you're iterating over is not possible, for obvious reasons. What were you tring to do? I can't think of many use cases that would be in need for modifying a list you're iterating. If you do have a good use case, first ListDuplicate the list, then Append to the duplicated list.