Mapreduce Suitescript 2.0-呼叫客户记录以删除子列表行

Mapreduce Suitescript 2.0-呼叫客户记录以删除子列表行,mapreduce,netsuite,suitescript,Mapreduce,Netsuite,Suitescript,我从mapreduce脚本的映射部分上传递的值调用客户记录时遇到问题。它向我发送了一个调试错误“TypeError:在对象262059中找不到函数加载”。其中262059是从getInputData函数传递的客户的内部ID NetSuite调试映像。。。 下面是引发此错误的函数的编码 function removeLine(r,recordId){ try{ log.audit({title:"removeLine"}); var

我从mapreduce脚本的映射部分上传递的值调用客户记录时遇到问题。它向我发送了一个调试错误“TypeError:在对象262059中找不到函数加载”。其中262059是从
getInputData
函数传递的客户的内部ID

NetSuite调试映像。。。

下面是引发此错误的函数的编码

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);
        }
    }
函数移除行(r,记录ID){
试一试{
log.audit({title:“removeLine”});
var customerRecord=r.负载({
“类型”:r.type.CUSTOMER,
“id”:记录id,
“isDynamic”:正确
});
调试({详细信息:“recordId=“+recordId});
var index=rec.getLineCount('item');
调试({detaisl:'index=“+index});
对于(var cnt=0;cnt
我遗漏了什么或不理解什么?我感谢你的指导


Brad

我认为问题在于加载记录的位置:

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

它应该是
r.load
,而不是
r.load
,因为JavaScript区分大小写。

感谢代码更改建议。但是,我仍然收到相同的错误-“TypeError:无法在对象262059中找到函数加载”。是因为代码将customerId视为文本并查找数字吗?请说明如何调用
removeLine
;我猜您正在传入
recordId
,您应该在此处传入对
N/record
模块的引用。Eric-非常感谢您抽出时间来帮助我。下面是调用remvoeLine的代码。
函数映射(context){try{var searchResult=JSON.parse(context.value);log.debug(“searchResult”,searchResult);var customerId=searchResult.id;log.debug(“customerId”,customerId);//var customerName=searchResult.altname;//log.debug(“customerName”,customerName);//var entityId=searchResult.entityId;//log.debug(“entityId”,entityId);removeLine(customerId);}catch(exception){log.debug(“映射错误消息:”,exception);}
成功了!这是有史以来第一款Suitescript,我感谢您的帮助!