Hi everyone, We have an auto invoicing script that...
# suitescript
m
Hi everyone, We have an auto invoicing script that had been working for over a year begin to break very recently with this error:
name: "INVALID_RCRD_TRANSFRM",
message: "That is not a valid record transformation.",
on this code:
record.transform({
fromType: record.Type.SALES_ORDER,
fromId: data.salesId,
toType: record.Type.INVOICE,
isDynamic: false
});
b
can the sales order be transformed into an invoice from the ui?
m
Yes
b
what does the url look like while doing so
m
/custinvc.nl?id=45490017&e=T&transform=salesord&memdoc=0&whence=
j
Is this happening on all your sales orders?
when did the issue begin? we have a similar auto-process script (also creates the purchase orders and vendor bills) and as far as I know, our sis still running fine. We also use record.transform to go from the SO to the IV.
Copy code
var invoice = record.transform({
		    		fromType: record.Type.SALES_ORDER,
		    		fromId: bo_id,
		    		toType: record.Type.INVOICE,
		    		isDynamic: true
		    	});
m
It’s not doing it on all orders. Probably, about 20%. But it just started happening about 1 week ago and previously it always worked just fine.
c
I've only seen that error if the from ID is bad or you've messed up the to/from record types which doesn't seem to be the case here.
b
the most common ones are that the sales order cant be billed into an invoice
usually from it billing to a cash sale instead
or it not being in a billable status
c
yeah the bad ID was lumping in there but thats gotta be it
m
Yeah, it’s billable, and the id on the sales order is valid
the timing makes me suspect a 22.2 issue, but i don’t know.
c
Do you have a Sales Order that worked vs this one that isn't that you can just do a visual compare against to double check?
m
Yes, and so far the issue seems to be with SOs from a specific department where the payment method is blank as terms are set to net 30. That’s the only thing I am seeing so far, but, AFAIK the payment method should be that way on those orders.
I tried setting the payment method in the transform call to undefined or an empty string in the defaultValues object, but that didn’t work.
b
what does the script look like
m
It’s a bit of a long script that checks for several fields on Item Fulfillment records on the SO, and if all that criteria meets certain settings, it then grabs some shipping values, adds those up, and creates the invoice and adds a fee to the invoice. So, I am hesitant to paste the entire thing here. But, for example, this saved search grabs the SOs from two departments. If I change that department lines of the filters to just ‘35’ nothing will break. It only breaks on dept 37, and the only thing I’ve seen there are the payment methods thing I mentioned above. But it otherwise works, and was even working for dept 37 until about a week ago:
var salesorderSearchObj = search.create({
type: "salesorder",
filters:
[
["type","anyof","SalesOrd"],
"AND",
["status","anyof","SalesOrd:F","SalesOrd:E"],
"AND",
["mainline","is","T"],
"AND",
["department","anyof","35", "37"]
],
columns:
[
search.createColumn({
name: "internalid",
sort: search.Sort.ASC,
label: "Sales Order Internal Id"
}),
search.createColumn({name: "total", label: "Total"}),
search.createColumn({name: "tranid", label: "SO"}),
search.createColumn({name: "status", label: "status"}),
search.createColumn({name: "paymentmethod", label: "Payment Meth"})
]
});
Maybe this is a support case?
b
the usual is enough code to reproduce the issue
preferably the minimal amount of code necessary to reproduce the issue
you will need to do it anyways for support, your support case will take forever if you send them giant scripts
m
just an update here, this started working on it’s own again the following day without any changes. 🤷‍♀️🙄