why is it that when using `renderer.addRecord` for...
# suitescript
e
why is it that when using
renderer.addRecord
for a Customer Payment we only get the
apply
sublist and no others (
credit
,
deposit
), even though the Netsuite Advanced PDF Template clearly does have access to these sublists. Are they not using the same method, or in other words is the advanced template privileged over our API access through the N/render module? (2.X)
b
addRecord is N/record based, you get access to the same things you get when you load the record to edit it
render.transaction has access to the same data as an advanced pdf template, which does have access to those sublists
e
that is not my experience. so, a record of type customerpayment, when I call
getSublists()
I do not see “credit” in the list. Only “apply” - however, when I view the XML (&xml=T) I do indeed see the credit sublist. I can access this via native Advanced PDF print templates; however, not in render. Thoughts?
is this a standard vs dynamic mode issue??
this has nothing to do with loading the record with isDynamic = true, because even here the credit sublist is non existant
b
load a customer payment in script
then examine its sublists
you have access to the same data on methods related to N/record
for advanced pdf templates, you can use the SuiteBuilder Advanced Templates Reference, or alternatively take a look at the field list while editing the advanced template in the ui
👍 1
different modules have access to different data
they are all the same database underneath so its generally similar but there are differences
for example, using xml views doesnt give you access to parent/child custom record relationships while N/record does
e
yea, so what I am seeing is that through record.load of a payment and getSublists I do not see one called credit, but in the documentation you sent (THANK YOU! This is clutch to see) I do however see the credit sublist. So, like you said, they have access to a sublist that I do not - somehow… 🧐
from the docs you shared (THANKS AGAIN) I see credit here
Truth be told, this mimics the UI behavior: Create = credit appears in the list of sublists; and on screen Edit = credit sublist disappears from the list in script, and on screen One of those oddities. Somehow on VIEW it is there in the UI? And in the XML. And in Advanced PDF. But not in N/render nor N/record!
b
payments are one of the more unusual records in that its different on view or create vs edit
loading a record in suitescript is equivalent to editing, so thats what you have access to
if you were creating the customer payment in suitescript, you would have access to the credits sublists
there isnt really an equivalent to viewing a record in suitescript, the only way you get it is in a beforeLoad on a view
e
ok, but my point is that somehow NS does have access to this sublist even though I do not - via N/render - which should in my opinion mimic the print function of a payment in Advanced PDF… that’s the quandary
b
you are using the wrong method
you are using renderer.addRecord, which is record based
use the same method netsuite uses for transactions
e
well, why didn’t you say so? just kidding. sorry I totally missed that. will give it a shot thank you for all the help - and patience! 🤦
i see now what you are referring to. this won’t work as we are combining multiple data sources and providing our own xml to render. so
render.transaction
won’t help in this situation. I need to add a record as a data source… but the payment record behaving as it does, does not expose that sublist. hmmm
b
you may want to consider using a pdfset to combine multiple pdfs into 1
e
thanks, but that’s not the idea. trying to compile a single pdf where there are multiple data sources. it works generally, but won’t work with the credit sublist on payments due to this anomaly