How do you unset a date field in SuiteScript 2.0? ...
# suitescript
e
How do you unset a date field in SuiteScript 2.0? I am hitting an
INVALID FIELD VALUE
when setting to null or empty string. In the UI, I can simply remove the data…
e
wow, just from today even? cool. Not working for me, though. I’ll test again.
require([‘N/record’], function(record) { var REC = record.load({ type: record.Type.WORK_ORDER, id: 387363 }); REC.setValue({ fieldId: ‘startdate’, value: null }); REC.save(); }); Or, REC.setText both don’t work. both with null or ‘’
in the Script Debugger (hence the “require”)
b
there is actual functionality for workorders around the startdate
im not sure that you can blank it out
e
really? in UI I can set the enddate and clear the startdate and it calculates
not a required field or anything; no error pops up, it just populates post save
b
probably that same process is preventing you from nulling its value
there is an actualproductionstartdate field, and a isactualprodstartdateenteredmanually checkbox to go with it
e
What do those do? And where do you see that? And how can I accomplish the same as clearing the startdate in the UI?
thanks @battk for all your replies all the time by the way!! you’re a real “slacker”
b
might be feature dependent
e
Aha. I'll look into it. I want to have NS calculate the start date backwards from the end date but if I have a value in the start date it keeps it regardless