Hi, I am working with dates on a SS2.0 script. Tas...
# suitescript
r
Hi, I am working with dates on a SS2.0 script. Task is to parse a CSV file and update transaction records with the data contained within the CSV. I am able to iterate over the CSV lines, output the values from the CSV to log statements, open the transaction record I need to update and read data from it, however I am running into problems when updating a date field. The date showing in the CSV file is: 12/17/2020 The date showing on the log output is: 12/17/2020 The error being returned from NetSuite is: {"type":"error.SuiteScriptError","name":"INVALID_FLD_VALUE","message":"Invalid date value (must be M/D/YYYY)" From what I can see, the date is already in the correct format. Any ideas?
b
setValue requires a Date object to set date fields
setText requires a string to set date fields
Be weary of directly using strings from your input if you have to support multiple date formats
r
Of course it does! 😄 Thanks for the help!