Marty Zigman - The NetSuite Expert

Conversations with Marty Zigman

Certified Administrator • ERP • SuiteCloud

Prolecto Labs Accelerator Templates

NetSuite Tip: How to Submit a Date Field with SuiteScript 2.0

NetSuite Technical



This article is relevant if you are using SuiteScript 2.0 to submit a date field to NetSuite.

Background

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.

What is the right syntax?

SuiteScript 2.0 to Submit a Single NetSuite Date Field

Here is some sample code to update a record on a custom table.

//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 nsRefId = 33445 //record ID
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}});

Work with Expert NetSuite Help

A thank you to our senior consultant, Boban, who offered this up to our team. If you enjoy the NetSuite Platform and want to be appreciated for the unique way you think and innovate, let’s have a conversation.

Marty Zigman

Holding all three official certifications, Marty is regarded as the top NetSuite expert and leads a team of senior professionals at Prolecto Resources, Inc. He is a former Deloitte & Touche CPA and has held CTO roles. For over 30 years, Marty has produced leadership in ERP, CRM and eCommerce business systems. Contact Marty to set up a conversation.

More Posts - Website - Twitter - Facebook - LinkedIn - YouTube

About Marty Zigman

Marty Zigman

Holding all three official certifications, Marty is regarded as the top NetSuite expert and leads a team of senior professionals at Prolecto Resources, Inc. He is a former Deloitte & Touche CPA and has held CTO roles. For over 30 years, Marty has produced leadership in ERP, CRM and eCommerce business systems. Contact Marty to set up a conversation.

Biography • Website • X (Twitter) • Facebook • LinkedIn • YouTube

3 thoughts on “NetSuite Tip: How to Submit a Date Field with SuiteScript 2.0

  1. Christopher says:

    Please could you also give this for date time fields?

  2. Marty Zigman says:

    Hello Christopher,

    This article is referencing a DateTime field. Am I confused?

    Marty

  3. Kyle Waid says:

    Working with datetimes in Suitescript has been somewhat frustrating. I came across this article and this solution resulted in an error.
    “type”:”error.SuiteScriptError”,”name”:”INVALID_FLD_VALUE”,”message”:”You have entered an Invalid Field Value 11/13/2024 11:26:00 am for the following field:

    I have found in my experience the only way to get a datetime field to submit in SS2x is to use a date object instead of any kind of string.

Leave a Reply

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