https://netsuiteprofessionals.com logo
#suitescript
Title
# suitescript
u

7px

04/11/2022, 9:01 AM
Is there a specific function or way to retrieve child record sublist IDs in a parent record for SS2? Context is I've used a Child Custom Record as a sublist for a Parent Custom Record, and now I'd like to fetch the values from that sublist. As per *ehcanadian*'s suggestion, I am able to "see" the id of the child record sublist using
record.getSublists()
. However, attempting to reference the sublist using the returned sublistId with
record.getSublist()
returns null, leaving me with little to no options on how to access the list. Am I correct to assume that NS detects the child record list in the parent record as a sublist, but cannot read its values as one? If so, how do I go about accessing it? Clearly I can "see" it using
record.getSublists()
, but any attempt to make a reference to it using documented methods turn up moot. Checking the documentation on
Custom Child Record Sublist IDs
doesn't help either. I've copied and pasted the exact same IDs on the script in multiple variations to no avail. I'm unsure at this point if I'm just forgetting a permission or access issue or I'm loading the sublist wrong. EDIT: After much testing, I've determined that using
context.newRecord.getSublists()
returns sublists, but passing the newRecord object in a
log.debug()
shows it doesn't actually contain the values of said sublists. I tried loading the record using
record.load()
, and passing it through the
log.debug()
reveals all the values of the sublist in question. That said, is there any way to access the sublist in
UserEventType VIEW
?
e

ehcanadian

04/11/2022, 1:22 PM
Does your child record have 'Allow Child Editing' enabled? It needs to be enabled to be accessible via the sublist.
u

7px

04/12/2022, 12:36 AM
it does, and I've enabled other options such as Allow Delete, Attachments, and whatnot. I'm starting to think that it's a Freemarker limitation that Netsuite template rendering can't process custom record sublists, despite it being able to access regular Netsuite-default sublists just fine, though I may just be ill-informed at the moment.
e

ehcanadian

04/12/2022, 12:41 AM
The linking field in the child record also needs to be have 'Show in list' checked
u

7px

04/12/2022, 7:21 AM
I've tried that as well, to no avail. While not entirely helpless, I've resorted to loading the same record through
record.load()
instead, and fetching the sublist values from there. It's extra steps, but it gets the job done. My only qualm is how child record sublists are terribly unsupported, as firing tests using the
Advanced PDF templates
show that even that can find the sublist but can't render the data in it. Thanks regardless, your input was highly informative regarding the issue.