Netsuite "Invalid assignment left-hand side" 提交记录时
Netsuite "Invalid assignment left-hand side" when submitting records
我正拼命更新 NetSuite(自定义记录)中链接到入库的字段,
var record = nlapiLoadRecord("inboundshipment", 74);
record.setFieldValue("custrecord_sent_to_jb", "test");
nlapiSubmitRecord(record);
var nlobj = record;
return nlobj;
当我评论 nlapiSubmitRecord(record) 时,返回的记录在 JSON 中更新,但在 NetSuite
中没有更新
不知道为什么我提交记录的时候收到"Invalid assignment left-hand side"信息(我在SS2.0也试过,问题出现在var NSID = tran.save())
/**
*@NApiVersion 2.x
*@NScriptType restlet
*/
//Use: Update NS inboundshipment / itemfulfillment with data (context) that is passed from JB
define(['N/record'], function(record) //use the record module
{
function postData(context)
{
//
var tran = record.load({type:context.TransactionType, id:context.TransactionNumber});
var message = context.Date + "|" + context.SED;
log.debug("RESTlet JB","loaded the tran with NSID: " + context.id);
//set some body fields
tran.setValue("custrecord_sent_to_jb", message);
//save the record
var NSID = tran.save();
log.debug("RESTlet JB","saved the record with NSID: " + NSID);
return NSID; //success return the ID to JB
}
//get and post both required
return {
get : function (){return "received";},
post : postData //
};
});
自定义记录:
如有任何帮助,我们将不胜感激
检查是否还有其他脚本,很可能是部署在 context.TransactionType 值上的用户事件脚本。由于这是一个 RESTlet,它将触发部署在记录上的用户事件脚本。
为什么不做一个 submitField?省去很多麻烦。
我正拼命更新 NetSuite(自定义记录)中链接到入库的字段,
var record = nlapiLoadRecord("inboundshipment", 74);
record.setFieldValue("custrecord_sent_to_jb", "test");
nlapiSubmitRecord(record);
var nlobj = record;
return nlobj;
当我评论 nlapiSubmitRecord(record) 时,返回的记录在 JSON 中更新,但在 NetSuite
中没有更新不知道为什么我提交记录的时候收到"Invalid assignment left-hand side"信息(我在SS2.0也试过,问题出现在var NSID = tran.save())
/**
*@NApiVersion 2.x
*@NScriptType restlet
*/
//Use: Update NS inboundshipment / itemfulfillment with data (context) that is passed from JB
define(['N/record'], function(record) //use the record module
{
function postData(context)
{
//
var tran = record.load({type:context.TransactionType, id:context.TransactionNumber});
var message = context.Date + "|" + context.SED;
log.debug("RESTlet JB","loaded the tran with NSID: " + context.id);
//set some body fields
tran.setValue("custrecord_sent_to_jb", message);
//save the record
var NSID = tran.save();
log.debug("RESTlet JB","saved the record with NSID: " + NSID);
return NSID; //success return the ID to JB
}
//get and post both required
return {
get : function (){return "received";},
post : postData //
};
});
自定义记录:
如有任何帮助,我们将不胜感激
检查是否还有其他脚本,很可能是部署在 context.TransactionType 值上的用户事件脚本。由于这是一个 RESTlet,它将触发部署在记录上的用户事件脚本。
为什么不做一个 submitField?省去很多麻烦。