RE: Invalid date value (must be D/M/YYYY)
I received this error with RESTlet script, I am using POST method in postman to create a record via suitescript 2.0 and I have to set value for date field and the type of field is Date and I faced this issue, I was searching and trying multiple solution but none of all was succeeded.
Anyone can help me ?!
Hi,
What value is being posted? It’ll come through as a string unless you’re converting it.
And are you trying setValue() or setText()?
We’ll likely end up using the N/format module but some further details would be useful.
Thanks,
Chris
the below is my code
// Create a NetSuite record from request params
function _post(context) {
doValidation([context.recordtype], [‘recordtype’], ‘POST’);
var rec = record.create({
type: context.recordtype,
isDynamic: true,
});
for (var fldName in context)
if (context.hasOwnProperty(fldName))
if (fldName !== ‘recordtype’) {
if (fldName === ‘custrecord_az_payroll_sheet_date’) {
rec.setValue(fldName, context[fldName])
}
rec.setValue(fldName, context[fldName])
}
var submitRec = rec.save({
enableSourcing: true,
ignoreMandatoryFields: true
});
var output = new Object();
output.submitRec = submitRec;
return output;
}
Could you share a sample of the data that you are posting?