Submit a Date Field with SuiteScript 2.0

The ability to submit a single field of data to a record is efficient. Date fields are generally tricky in NetSuite. You may be getting an error such as “You have entered an Invalid Field Value 3/24/2019 3:27 PM for the following field:” message.

//assuming you are referencing the N/format module as "format", then this is how you get a NetSuite date string and submit it to the database
var dateStr = format.format({value: new Date(), type: format.Type.DATETIME});
record.submitFields({type: "customrecord_prolecto_bitcoin", id: nsRefId, values: {custrecord_prolecto_bitcoin_dts: dateStr}});

Leave a comment

Your email address will not be published. Required fields are marked *