Seeing date objects not being able to be set in Le...
# suitescript
p
Seeing date objects not being able to be set in Leading accounts (2025.2.0.30061) Aka: new Date() always returns invalid value now
watching following 1
r
hmm i wonder if that's why StrongPoint is producing so many date errors
🫠 1
a
I’m always the old guy who always say use the native NetSuite API methods, but people never listen and I’m always crazy… If all your date operations are always handled by the ‘N/format’ module, you will never have this problem…
😆 2
🤓 2
☝🏻 1
☝️ 1
p
I think you may be on to something haha, just hoping it’s not an undocumented change - we have some cases where we’re utilizing format but unfortunately most of our code bases are all JavaScript dates in some manner.
Yep good call that is working….
a
The fact is new Date() is simply a native JavaScript function that could be handled differently depending on the Transcompiler used by NetSuite at any given time (Rhino, etc)... That can change but they will update their documented API methods...
💯 1
c
I use this a ton and haven't run into it (yet)
e
👀
j
for those with Strongpoint issues (failing workflow) you can actually tweak the script to fix it, this is what I did.
the offending script is
SP_WFA_CLSystemNoteUpdate.js
fix required starting at line 179
Copy code
for (var j in resultobj) {
                //++ 382132 convert dates properly before setting
                if ((j == 'custrecord_flo_actual_change' || j == 'custrecord_flo_system_note_date' || j == 'custrecord_flo_temp_changedate') && resultobj[j]) {
                    thisRecord.setValue({ fieldId: j, value: format.parse({value: dateUtil.toSaveFriendlyDateTime(resultobj[j]), type: format.Type.DATE}) });
                } else if ((j == 'custrecord_flo_system_note_available') && resultobj[j]) {
                    thisRecord.setValue({ fieldId: j, value: resultobj[j] == 'T'});
                } else {
                    thisRecord.setValue({ fieldId: j, value: resultobj[j]});
                }
            }
they tried to setValue on a date field to a string, and on a checkbox field to ‘T’
sigh
apparently it “works in their account”
surprised their bundle scripts were not locked
p
Recent changes are making it quite hard to have anything locked anymore. Luckily this isn’t strongpoint any plain new Date Object not working in leading accounts. Waiting for a defect to be issued