<@U6SNW6BC3> Can you share your code? When you tra...
# suitescript
m
@mrob Can you share your code? When you transform a
vendorbill
into a
vendorpayment
, the apply sublist should contain all open bills for the vendor, with the apply column set to 'F', besides for the bill you transformed from which will default to apply = T. I've just tested in the console and it is behaving as expected for me.
m
Thanks for the response michoel! My code is as simple as:
Copy code
var vendPayment = record.transform({
        fromType: vendBill.type,
        fromId: vendBill.id,
        toType: record.Type.VENDOR_PAYMENT,
        isDynamic: true
      });
with a
vendPayment.save()
afterward
I'm in the console ad hoc debugging right now. So for example I've got
vendPayment.getLineCount('apply') => 0
vendPayment.insertLine('apply')
gives the
"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."
error
so basically it looks like the apply sublist doesn't have any open bills for the vendor!
m
Are you sure there are open bills for that vendor?
See screenshot I just posted, it's working for me
m
great question, i'm pretty sure! I go to a bill with
OPEN
status and open the console from there, load up that bill and transform it
ya the screenshot looks simple
and I had it working before, but I've tried a couple different bills today and no luck, will check another one
thought maybe i had imagined it working in the past
r
The vendor payment sublist is a static list, so you cannot insert a new line like you are trying to do with
Copy code
vendPayment.insertLine
m
ya i understand that. But for some reason it looks like some vendorbills are transforming into vendorpayments without anything pre-populated in the apply sublist (i.e. the payment has nothing it can be applied against, despite creating the vendorpayment from an open vendorbill- as you can see from the screenshot i put in the general channel) and I can't figure out why
thanks for the response!