Reputation: 388
I am trying desesperatly to update a field in NetSuite (custom record) linked to an inboundshipment,
var record = nlapiLoadRecord("inboundshipment", 74);
record.setFieldValue("custrecord_sent_to_jb", "test");
nlapiSubmitRecord(record);
var nlobj = record;
return nlobj;
When I comment the nlapiSubmitRecord(record), the record is returned updated in the JSON, but not the in NetSuite
I don't know why I receive "Invalid assignment left-hand side" message when I submit the record (I have tried also in SS2.0, the problem occurs at 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 //
};
});
Any help would be greatly appreciated
Upvotes: 1
Views: 142
Reputation: 2840
Check if there are other scripts, most probably User Event scripts deployed on the context.TransactionType value. Since this is a RESTlet, it will trigger User Event scripts deployed on the record.
Upvotes: 1