I encounter issue setting a custom field on an inb...
# suitescript
f
I encounter issue setting a custom field on an inbound shipment not saved but if do load again it works. Is there something i missed, please let me know. TIA
t
Maybe if you share a bit more information: • context the script is running in • sample of the the code
f
The script is a Restlet
It look up Inbound Shipment record using a container number
If found, it load the record then received it
before saving it populates a custom field inboundShipment.setValue('custrecord_shipment_no', obj.shipmentNumber); var id = rec.save(); log.audit('post', 'Received Inbound Shipment | id : ' + id); I don't see any errors after saving, but the custom field never get set. However If I reload the same record and set the custom field it works, but there are issues sometimes if the Inbound shipment is fully received it seems Netsuite put the record as read only and throw error on saving. var inboundShipment = record.load({ type: record.Type.INBOUND_SHIPMENT, id: result.id, //isDynamic: true }); nboundShipment.setValue('custrecord_shipment_no', obj.shipmentNumber); inboundShipment.save();
t
Not sure I can see your issue. But, I suspect it may be a timing issue. You have the record in Dynamic mode, and some records, Inbound Shipment may be one, need fields to be set in a particular order. You could try it in Non-dynamic mode, see if that helps the issue. When you say "reload" the record, do you mean in the script? If this is the case, I would try saving the record, then setting the custom field, and saving a second time.
f
Sorry got busy and not able read your reply right away, anyway thanks
I will try your suggestion