Running a CSV import from script (N/task) I'm gett...
# suitescript
s
Running a CSV import from script (N/task) I'm getting date format errors that don't seem to make sense to me. Anyone seen something like this before? when doing
csvTask.submit()
getting back
FAILED_TO_SUBMIT_JOB_REQUEST_1
and date formatting message something like
Failed to submit job request: Date field not in your preferred date format for field "Date" : 57 You have entered an Invalid Field Value 09/21/2022 for the following field: trandate : 4 You have entered an Invalid Field Value 09/22/2022 for the following field: trandate : 53.
k
What is the date format for the user/company preference? That normally would be the cause.
s
M/D/YYYY, I also reset it to MM/DD/YYYY - same error
also, same file, when imported using the UI rather than N/task, works 😞
I suspect it's something to do with the fact that the script runs as the
-System-
user
k
Yep it will be and would use the company preference not the user preference
I suspect anyway.
s
Right, so the formats I mentioned above are the company pref setting. Anyone know what the numbers after the colon indicate in the error message? like
57
in "Date" : 57?
and thanks for noodling this with me @karlenigma
k
The field type does seem odd
This is the type of error that would have my throwing my laptop! 😂
s
I don't know if I've ever ran CSV imports from script this way, but it's an existing solution I'm trying to diagnose.
that error message feels more like a CSV-import-specific wording than typical SuiteScript
k
Yeah nor me.
d
idk if helps at all, but just saw this pg entry matched some of the verbiage: https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/section_4570011199.html maybe the number is the matching internalid, formid, or CSV row# etc. - all just random guesses off the top of my head 😂 maybe better luck posting in csvimports channel as well
s
Thanks @dbarnett, didn't know such a channel existed. I think I narrowed this down to a date format discrepancy. I searched quite a bit the only thing I could find is the
-System-
user is supposed to use the company-wide setting for date formats but that isn't what's actually happening. In my case it seems perhaps
-System-
is using the top level subsidiary's date format 😕?
b
redo the trandate mapping using a user that uses the company's date format
make sure the csv file matches
do not use excel
or any other spreadsheet program to confirm the file format in the csv
s
@battk Are you suggesting the date format is dictated by the user [date preferences setting] that created the mapping?
the only clue I found is the top level sub is set to DD/MM/YYYY whereas the company is MM/DD/YYYY. It appears the CSV import is forcing DD/MM/YYYY format when invoked via N/task.
k
That is what I was alluding to the other day. Maybe I should have been clearer 😂
s
which part are you referring to @karlenigma? 🙂
b
it shouldnt be unless it was hardcoded
redo it anyways
its also really weird to have the top level subsidiary have a different date format to the company's general preferences
they are supposed to be the same data behind the scenes
s
In this case the top level sub is in a country with a different format.... my guess is the top level sub is used for reporting for some folks but the bulk of the business is recorded against the child sub