```for (var i = 0; i < fulfillTransform.getLine...
# suitescript
x
Copy code
for (var i = 0; i < fulfillTransform.getLineCount({ sublistId: 'item' }); i++) {
  var lineItem = fulfillTransform.getSublistValue({
    sublistId: 'item',
    fieldId: 'item',
    line: i
  });
  var lineBillingType = fulfillTransform.getSublistText({
    sublistId: 'item',
    fieldId: 'custcol_billing_type',
    line: i
  });
  if (soArray[a].items.indexOf(lineItem) === -1 || lineBillingType !== "One Time") {
    fulfillTransform.removeLine({
      sublistId: 'item',
      line: i
    });
  }
}
n
Is it because the Sublist becomes smaller than your original Sublist line count and your loop i exceeds the available Sublist lines.
n
you need to loop backwards in other words 😉