I am not sure what I am doing wrong on this paymen...
# suitescript
c
I am not sure what I am doing wrong on this payment. I keep getting
Copy code
You have attempted an invalid sublist or line item operation. You are either trying to access a field on a non-existent line or you are trying to add or remove lines from a static sublist.
If I get a -1 from findSublistLineWithValue I create a new payment line on VENDOR_PAYMENT
Copy code
var paymentLine = payment.selectNewLine({sublistId: 'apply'});

         paymentLine.setCurrentSublistValue({
                   sublistId: 'apply',
                   fieldId: 'apply',
                   value: true
         });
          paymentLine.setCurrentSublistValue({
                    sublistId: 'apply',
                    fieldId: 'amount',
                    value: context.amount
          });
           paymentLine.setCurrentSublistValue({
                    sublistId: 'apply',
                    fieldId: 'refnum',
                    value: context.tranid
                    }).commitLine({sublistId: 'apply'});
Not sure what I am missing.