I'm running into an issue when transforming a sale...
# suitescript
s
I'm running into an issue when transforming a sales order into an invoice. This is the code I have. I am DEFINITELY on a sales order, but it keeps giving me the error
That is not a valid record transformation
Copy code
record.transform({
    fromType: record.Type.SALES_ORDER,
    fromId: newRec.id,
    toType: record.Type.INVOICE,
    isDynamic: true,
});
Any ideas as to why this would be erroring? I've tried this in a beforeLoad and beforeSubmit
d
Is the ID you're giving it a cash sale?
e
Is the sales order in Pending Approval status?
s
It's pending bill. And yes it's a sales order. I was able to convert it to a cash sale but I couldn't convert it to an invoice for some reason
b
sales order to invoice depends on the sales order form
one form always is an an invoice, one form is always a cash sale, one form is a cash sale if payment method is set, else invoice
e
Basically change the customform field to the Sales Order - Invoice form, and not the Sales Order - Cash Sale form. It could also be that someone has put payment details against the Sales Order, which NetSuite is assuming would mean it needs to be a Cash Sale...