Anyone having strange issues around date fields? ...
# suitescript
t
Anyone having strange issues around date fields? I’m getting the error :
Copy code
"You entered 'null' into a field where a calendar date was expected.\\nPlease go back and change this value to the correct date."
The trouble is I can log the value of the field before and after I set it and it all appears fine. I’ve tried creating the date object like 50 different ways (might be a slight exaggeration) but the issue seems to persist. The only other error message I managed to get from it was the date being an incorrect format. At the moment I use
new Date()
with the unix timestamp to get the date object and from what I can tell that should be fine?
b
which date field?
and what code are you using to set it
t
It’s a custom field we created. The code is:
Copy code
salesOrder.setSublistValue({
    sublistId: 'item',
    fieldId: 'custcol_assoc_sub_start_date',
    line: lineId,
    value: new Date(startDateObj)
});
Then it breaks on the salesOrder.save() line
b
the error message you are getting is unusual looking, its not the error normally associated with a date field?
are there any customizations throwing that error
do you get an error with simply new Date()
what type of field is your custom sublist field
t
I can’t find any customisation that’s throwing that error but to be honest there’s quite a lot of work on this account so it’s very much possible. I tried with just new Date() and I got the same error. The field is a Date type. When I was looking up the field type I did notice it’s set up to source from another field. Do you think that’s possibly overwriting it after my code? My code is running afterSubmit so I don’t imagine it will
p
Can you just double check that “Store Value” is set on the column? It’s not always set on sourced fields
t
It is set. Should it not be?
b
my recommendation is to try harder at workflows or user event scripts that could throw that error
you can try disabling all of them
or at the very least create your own matching field that is not scripted to see how it works
as far as i can tell, you are setting the field correctly