I see that error very often when people try to loo...
# suitescript
e
I see that error very often when people try to loop forward through the lines and remove some or all of them; you inevitably go past the sublist length
c
Slight tangent. I assume the line id is always maintained though?
e
You remove lines using their index, and as you remove lines, all the indices collapse immediately to remain contiguous. Not sure which
line id
you mean in this context.
c
the item sublist
the line field
I believe this field is always maintained - I can see orders with 4 items in the item list with one item having a 'line' 8
the index is a 'point in time' in your code, the .length of a list will need recalculating every time you remove or add an item (depends exactly what you're doing).