Netsuite“;“左侧的赋值无效”;提交记录时
我正在尝试专门更新NetSuite(自定义记录)中链接到InboundShipping的字段Netsuite“;“左侧的赋值无效”;提交记录时,netsuite,suitescript,suitescript2.0,Netsuite,Suitescript,Suitescript2.0,我正在尝试专门更新NetSuite(自定义记录)中链接到InboundShipping的字段 var record = nlapiLoadRecord("inboundshipment", 74); record.setFieldValue("custrecord_sent_to_jb", "test"); nlapiSubmitRecord(record); var nlobj = record; return nlobj; 当我注释nlapiSubmitRecord(记录)时,返回的记录会
var record = nlapiLoadRecord("inboundshipment", 74);
record.setFieldValue("custrecord_sent_to_jb", "test");
nlapiSubmitRecord(record);
var nlobj = record;
return nlobj;
当我注释nlapiSubmitRecord(记录)时,返回的记录会在JSON中更新,但不会在NetSuite中更新
我不知道为什么在提交记录时会收到“无效分配左侧”消息(我也在SS2.0中尝试过,问题发生在var NSID=tran.save()上)
自定义记录:
如果有任何帮助,我们将不胜感激请检查是否有其他脚本,最有可能是部署在context.TransactionType值上的用户事件脚本。由于这是一个RESTlet,它将触发部署在记录上的用户事件脚本。为什么不执行submitField?为您节省了很多麻烦。谢谢@Rusty,您完全正确,这是由于另一个用户事件造成的。
/**
*@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 //
};
});