I'm not able to understand you problem.If you have a list of Users and use the ListClear on it, there won't be any elements on the list anymore. So how are the inner lists relevant? They won't be accessible anymore.

Joao, you would think it works that way but it doesn't that's why I'm reporting this bug.

Gateway credentials (nested record list) never clear and it's a bug! It keeps getting added, listclear is not doing it's job!

I'm 100% certain if you check your listclear method under the hood, you will find that your loop is wrong. Nested record list id not clearing. So when you use Append again it will add to the record with the nested record list from the previous record item.

Listclear simply does not clear nested record list and that's the bug here.

Joao, you would think it works that way but it doesn't that's why I'm reporting this bug.

Gateway credentials (nested record list) never clear and it's a bug! It keeps getting added, listclear is not doing it's job!

I'm 100% certain if you check your listclear method under the hood, you will find that your loop is wrong. Nested record list id not clearing. So when you use Append again it will add to the record with the nested record list from the previous record item.

Listclear simply does not clear nested record list and that's the bug here.

Despite you saying there's not problem anymore, I wanted to understand what you are doing. Most crucially to my lack of understanding is what lists you iterate over in the two foreaches. The ListClear can't clear the list of the first ForEach, as you can't mutate the list you're iterating. So it must be you are clearing a list that's an attribute of the .Current of the iterated list. The second ForEach then must iterate over that attribute, and it must not do anything, since you have just cleared the list.

What I'm puzzled about is your question about a nested list, which seems to imply you're clearing an attribute list that also has a list in its elements, but then the second ForEach loops over a Current that isn't explicitly set...