I feel like I'm going crazy here.... Trying to set...
# suitescript
e
I feel like I'm going crazy here.... Trying to set the "duedate" field to today and I'm getting the error of "Invalid date value (must be M/D/YYYY)"
Copy code
let todaysDate = format.format({
                value: new Date(),
                type: format.Type.DATE
            })

            purchaseReq.setValue({
                fieldId: 'duedate',
                value: todaysDate
            });
Logged out todaysDate and got 5/27/2022
s
just use
new Date()
when using setValue, or make it a string and use
setText
j
^^^ setValue is expecting a Date Object not a string.
format.format returns you a string
e
thanks all