0
votes

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 {
                    rec.selectNewLine({
                        sublistId: 'custpage_items_sublist'
                    });

                    rec.setCurrentSublistValue({
                        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.name, 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 = cr.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!

1
Yes. What sublist type are you using from the serverWidget module?zerecees
@zerecees, you are right on. We discovered recently that the LIST type is not supported for editing in a Client Script. We needed to switch to INLINEEDITOR or move the editing back over to the SuiteLet for this to work.Ben Rogol

1 Answers

0
votes

We were able to resolve this issue recently. This problem was due to defining the SuiteLet sublist as SublistType.LIST. NetSuite doesn’t support editing sublists defined as “LIST” outside of server-side scripts. Thus, we encountered this strange error when trying to edit it via the Client Script.

Two possible solutions are:

Change SuiteList SublistType to “INLINEEDITOR.” Move sublist editing over to Server Side (SuiteLet).

Thanks! Perhaps this will help someone out in the future at least.