RE: How to modify a SuiteLet sublist via linked Client Script?

Hi there, I have a SuiteLet with an empty sublist. A button on the SuiteLet directs to a Client Script which is attempting to populate the sublist. I’m encountering a strange error on my Client Script—”undefined is not an object (evaluating ‘olddata[i]’).” This is a JavaScript error, I believe referring to “rec” in the following code. The error initiates on “rec.commitLine.”
function populateSublist(fieldValues, rec, availableItems) {
        log.debug("Rec", rec);
        if (availableItems[0]) {
            for (i = 0; i < availableItems.length; i++) {
                try {
                        sublistId: 'custpage_items_sublist'

                        sublistId: 'custpage_items_sublist',
                        fieldId: 'custpage_parent_frame',
                        value: availableItems[0].item_parent_frame

                    // More values being set...

                    rec.commitLine({ // <=== *** RIGHT HERE ***
                        sublistId: 'custpage_items_sublist'
                } catch (e) {
                    log.error("Unable to commit line - " +, e.message);
        } else {
            log.debug("No available items for given parameters.")


Here are some things I know:

  1. “rec” is working previously and getting field names I need.
  2. “rec” is showing “{“id”:””,”type”:null,”isDynamic”:true}” in my execution log.
  3. The beginning of my Client Script uses “var rec = currentRecord.get();” to receive the record.

Is it possible to modify a SuiteLet sublist from a Client Script? I’ve never done this in particular before, so I’m at a loss here. Any help or ideas are immensely appreciated! Thanks!

Ben_sr Rookie Asked on December 18, 2020 in SuiteScript.
Add Comment
3 Answers

Weird sublist behavior means you should use forceSyncSourcing.

Advanced Answered on December 18, 2020.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.