<@U86RW6Q92> It is a very tricky record to work wi...
# suitescript
a
@Azi It is a very tricky record to work with if you are creating the record make sure you do:
Copy code
const oVendorBillRec = record.create({
    type: record.Type.VENDOR_BILL,
    isDynamic: true,
    defaultValues: {
        entity: 'your_entity'
    }
});

If you are loading the record make sure you use:
isDynamic: true
a
@alien4u I am trying it in Dynamic mode as per your suggestion, but I am still not seeing how I can get hold of that data
a
What that do you need?
a
credits applied
a
Loop through the apply sublist and lines with the apply set to true, in some cases == T
a
So I did that, and it worked for applied to (payments) for bills but not for credits applied
b
its not convenient to get from payment to credits
searches and queries represent that relationship as between a credit and a bill
which complicates things if there are multiple payments to a bill
records represent that relationship differently depending on if you are viewing/creating a record vs editing it
on view/create, you have access to the credits applied on the payment
on edit (which includes loading a record) you dont
the credit behaves normally and has an apply sublist no matter the user event type
so if you really wanted to, you could do a search/query to get the credits that apply to the payment's bills and load each credit to see which payment it applies to
the other answer is that when printing payment, the applied credits sublist is available
you can print a transaction with a form/template that includes the credits as html, then parse the html to get to the credits
example code for that method
a
Okay. I guess if this is my only option I will have to go with this absurd answer. I was actually thinking if there was some way to use a headless browser to scrape the data, but this is definitely a little less absurd.
m
Headless browser is definitely possible. I've been using puppeteer for a project recently to export/import custom object translations
a
So I have played around with puppeteer a few years back, but I am not familiar enough to do something like this
m
Hopefully I'll publish something in the next few weeks
a
👍