Hello Everyone Can anybody help me to solve the e...
# suitescript
s
Hello Everyone Can anybody help me to solve the error that I get when I try to Transform a sales order into an invoice but an error occurred i.e you must enter a calendar date into date fields I have tried all the stuffs like Transform the date into an appropriate form create the date date object But still encounter the same error. need help to resolve this Thanks in advance.
b
what does your code look like
and what error do you get
s
My Code is just searching sales order whose status is pending billing and transform the sales order into invoice and it is working okay for most of the order but for some order I encounter error i.e "You entered 'null' into a field where a calendar date was expected.\\n Please go back and change this value to the correct date"
t
can you display your code, where you are setting fields for invoice?
s
Here is the part of the code var soToInvoiceRec = record.transform({ fromType: record.Type.SALES_ORDER, fromId: soId, toType: record.Type.INVOICE, isDynamic: true }); log.debug({ title: "soToInvoiceRec", details: soToInvoiceRec }); var objectDate = new Date(); var day = objectDate.getDate(); var month = objectDate.getMonth(); var year = objectDate.getFullYear(); var dateString = month + '/' + day + '/' + year; log.debug({ title: "Test Date created : ", details: dateString }); var parsedDate = format.parse({ value: dateString, type: format.Type.DATE }); log.debug({ title: "parsed Date || Typeof : ", details: dateString + " --||-- " + parsedDate }); soToInvoiceRec.setValue({ fieldId: 'trandate', value: parsedDate, ignoreFieldChange: true }); var invoiceId = soToInvoiceRec.save({ enableSourcing: true, ignoreMandatoryFields: true, }); log.debug({ title: "invoiceId", details: invoiceId });
b
thats not the usual error you get for setting or not setting date fields
disable workflows and user event scripts associated with invoices and try again
s
okay I will try then inform to you in the channel
tried but same error encountered
any other solution ?
b
my general recommendation would be to stop setting the ignore related parameters
if that doesnt work, try billing the order in the ui, any fields you have to set in the ui are field you have to set in script
s
"stop setting the ignore related parameters" What it means can you explain please.
b
ignoreMandatoryFields
ignoreFieldChange
ignoring field change means to stop telling netsuite you set a field
ignoring mandatory fields can hide the more helpful error messages
s
okay thanks I will work on the updation that you explain and thank you very much for helping me 🙂