I am trying to add lines to a transfer order in Netsuite. I want to add them on the latest order created between two specific locations.
I am trying this:
var s = search.create({
type : search.Type.TRANSACTION,
columns : ['internalid'],
filters : [
["location","anyof","61"],
"AND",
["transferlocation","anyof","62"],
"AND",
["mainline","is","T"],
"AND",
["trandate","on","today"]
]
});
var resultSet = s.run();
var latestTO = resultSet[0];
But I get this error when I try adding a line to latestTO:
{"type":"error.SuiteScriptError","name":"UNEXPECTED_ERROR","message":null,"stack":["anonymous(N/recordImpl)","onAction(/SuiteScripts/TEST.js:67)"],"cause":{"type":"internal error","code":"UNEXPECTED_ERROR","details":null,"userEvent":null,"stackTrace"
My script works if I "hardcode" the internalID of the latest transfer order.
Any ideas?
