Has anyone had to resolve the error "You must have...
# suitescript
s
Has anyone had to resolve the error "You must have at least one valid line item for this transaction" when attempting to transform a record? (In my case, trying to transform a sales order to an item fulfillment). The transformation never happens, it fails on the record.transform line. I can't find any commonalities between the failing transformations.
a
Have you set the quantity on any of the line items and committed them?
s
I'm not sure what you mean. The line item has a ton of available quantity, and I don't load or edit the sales order in my code at all before trying to transform it
b
unless configured otherwise, you can only fulfill committed items
if you can't fulfill any items, you get the error you are seeing
s
I mean committed says 0 on this particular sales order for the item, but on another sales order that worked fine with this item, it also said committed 0.
I also don't know what changes that number
b
many things affect commitments
valid locations, quantity available at that location, received special orders, approved drop ship orders, completed work orders, line level commit column values
s
I hear marriage affects commitment.
😂 2
r
I would also check what happens if I fulfill that record in the UI. Check if the Item fulfillment has items in its sublist.
s
We actually just fulfilled one in the UI (from the purchase order "mark shipped button; there is no fulfill button on the SO) and it worked perfectly fine
so idk why it can fulfill in the UI but in my script, it thinks none of the lines are valid
b
whats the path in the url used by the button
s
/app/accounting/transactions/itemship.nl?id=376432&e=T&transform=purchord&shipstatus=C&poid=3437392&shipgroup=1&memdoc=0&whence=
however thats off the purchase order, and obviosuly in the script i need to create it off the sales order
b
what does your transform look like
s
Copy code
itemFulfill = record.transform({				fromType: record.Type.SALES_ORDER						fromId: createdfrom,									toType: record.Type.ITEM_FULFILLMENT,							isDynamic: true								});
or, if there is a ship group and a header level location, it also includes those as default values
b
you might not need the location
but that particular transform requires the shipgroup to be set
s
it should be being set anyways
how can you tell that from the url though?
b
netsuite doesnt add shipgroup to the url for fun
if its there, its required
memdoc, poid, shipstatus are not
transform=purchord could be changed to transform=salesord and it should be the same
honestly, i would expect
/app/accounting/transactions/itemship.nl?id=376432&e=T&transform=salesord&shipgroup=1
to work, which would also be the minimum needed for your transform
s
ok i can start by double checking that the shipgroup is in fact being defaulted in the transform
thanks
of course I also have an order failing with the same error whose url in the UI is much simpler:
/app/accounting/transactions/itemship.nl?id=27128&e=T&transform=salesord&memdoc=0&whence=
no shipgroup at all, it lets me transform directly from the sales order, and yet in the script I get the same error, you must have at least one valid line item on this transaction