what's the easiest way to copy items sublist to an...
# suitescript
a
what's the easiest way to copy items sublist to another record items sublist?
anything that will return the whole sublist object?
w
No, you need to iterate over all the items in the list.
a
100%?
no copy paste
transfer or something
w
You can copy a complete transaction if that is what you need.
But if you need to copy items from one sublist to another within the same transaction/record. Then no, I don't think so.
a
@Watz I want to copy items sublist from opportunity to the sales order
w
Why not transform the opportunity into a sales order then.
a
sorry from so to opp
which is not supported
w
Then I don't know of a quick-fix to do that. I'd loop through all the lines on the sales order and then replace the lines on the opp. Note that the opp might not have all the same columns as the sales order has. And this would be dependant on the execution context. If it was a M/R-script I would perform a search on the SO-lines instead of loading the record.
a
thanks
@Watz can we get the line object or we need to do it filed by field for every line?
w
I'd say you need to get it field by field.
p
Edit: didn’t read properly, removed my comments about transform :)
s
With NFT, you get sublist line objects presented as a collection making it pretty easy code to create the same lines on another record.