Brad D.
Brad D.

Reputation: 49

Suitescript 2.0 - Call customer record to remove sublist lines

I am running into an issue with calling the customer record from a passed value on my mapped section of my mapreduce script. It is sending me a debug error of "TypeError: Cannot find function load in object 262059". Where 262059 is the internal ID of the customer passed from the getInputData function.

NetSuite debug image... Netsuite debug image...

Here is the coding of the function that is throwing this error.

function removeLine(r,recordId){
        try{
            log.audit({title:"removeLine"});
            var customerRecord = r.Load({
                "type": r.Type.CUSTOMER,
                "id": recordId,
                "isDynamic": true
            });
            log.debug({details:"recordId = " + recordId});
            var index = rec.getLineCount('item');
            log.debug({detaisl:"index = " + index});

            for (var cnt = 0; cnt < lineCount; cnt++)
                {
                    log.audit({details:"Round " + cnt})
                    rec.selectLine({
                        sublistId: "item",
                        line: cnt
                    });
                    rec.removeLine({
                        sublistId: "item",
                        line: cnt
                    });
                }
            log.debug(recordId + " Item Pricing has been removed.");
            record.save();
        }catch(exception){
            log.debug("removeLine Error Message:",exception);
        }
    }

What am I missing or not understanding? I appreciate your guidance.

Brad

Upvotes: 1

Views: 3423

Answers (1)

erictgrubaugh
erictgrubaugh

Reputation: 8847

I believe the problem lies where you load the record:

var customerRecord = r.Load({
    "type": r.Type.CUSTOMER,
    "id": recordId,
    "isDynamic": true
});

It should be r.load, not r.Load as JavaScript is case-sensitive.

Upvotes: 1

Related Questions