Error: "Called EndIteration while the recordlist was not being iterated..."

Hi all,

In a "for each" cycle, I am assigning two RecordLists (using ListAppend) and then passing them into an Extension.

The error I get when I execute the extension is: "Called EndIteration while the recordlist was not being iterated..."

It doesn't run the extension action, just returns the above exception before it.

Anyone has ever come across something like this and how to solve it?


Pedro Carrilho
Hi Pedro,

That looks like a support issue. You should send the file that reproduces that problem to and they will help you.

Tiago Simões
Hi there Pedro!

Yes, probably it is an Outsystems bug, because it seems like the iteration is not even started, but there's a way to prevent that.

The solution is to change your Foreach cycle with an If condition (like simulating a While cycle).

I had that problem while iterating a list, and I did something like:

- If myList not empty, continue to the iteration path;
- Assign the values from the record at list's current position (position 0) - Or any other actions you want to take. And...
- In the end of the iteration path, made a ListRemove from myList at position 0.

I hope I could help.

Best regards!