I want to edit a Sales Order by adding a new Service Item and after adding I need to approve/change the status of SO to "Pending Fulfilment". When saving, the item get added into the sales order, but throws error at the status changing line as "Record has been changed". The script is developed in Suitescript 1.0
Step 1: I load the Sales order and add the service item into it and save the record.
Step 2: Again load the Sales order and set the Sales order status to "Pending Fulfilment" and save the record. Its not saved and ends with "Record has been changed" error.
In step 2, instead of changing sales order status, I tried by changing some other field and this time the SO get saved. So the problem is only with the changing status of SO.
I tried "nlapiSubmitField" api and that also not resolved my problem.
var soRec = nlapiLoadRecord('salesorder', SOId);
....
soRec.selectNewLineItem("item");
soRec.setCurrentLineItemValue("item","item",1093360);
soRec.setCurrentLineItemValue("item","custcol5",ringDesc);
soRec.setCurrentLineItemValue("item","povendor",46063);
soRec.commitLineItem("item");
var order_id = nlapiSubmitRecord(soRec, true, true);
var soObj = nlapiLoadRecord("salesorder", order_id);
soObj.setFieldValue("orderstatus", "B"); // B : Pending Fulfilment
var order_id = nlapiSubmitRecord(soObj, true, true);
The SO contains dropship items, so when saving the SO, the SO should saved and the respective PO should be created.
orderstatus? Why save the record twice? Also, what script type is this? What entry point? - erictgrubaugh