I want to just confirm that the only way to set t...
# suitescript
s
I want to just confirm that the only way to set the status of an inbound shipment is to first create it and then set the status like this code example , it just seems to unnecessary to create then update , unless this APi is not design that way
Copy code
var inboundShipmentId = inboundShipment.save();

var inboundShipmentUpdate = record.load({
    type: record.Type.INBOUND_SHIPMENT,
    id: inboundShipmentId,
    isDynamic: true
});
inboundShipmentUpdate.setValue({
    fieldId: 'shipmentstatus',
    value: 'inTransit'
} ....
m
I don't know if you can set the status before save. But if you have to do it after the save I would use record.submitFields instead of loading, updating and saving.
a
You can set the status on
beforeSubmit
so it should be perfectly possible to set it before save.
s
yeah, i was thinking on switching it to record.submitFields It is a bit faster, it doesn't seem to work on before save . I'm not sure why the NetSuite docs show
Copy code
record.load
m
It wouldn't work before save because just like load you need the id from the save in order to change the field. Like @alien4u mentioned I can't see why you can't set it before save anything that you can set after should be available to set before. I would suggest changing the order in which you set it...ie move it down a few lines maybe all the way to right before save and see if it sticks.
s
from my testing it does not work on before save if the record never exists before ie create