I'm looking to insert a line (beforeSubmit) and al...
# suitescript
e
I'm looking to insert a line (beforeSubmit) and also set values on that line but Im struggling. If I insert a line with the param of line: 0, how can I then set the values on that line?
s
Did you already try the standard
setCurrentSublistValue()
and
commitLine()
?
b
Those arent options beforeSubmit
s
Yeah i didnt think beforeSubmit was dynamic mode
e
I think I found the issue
I used insertLine, but then only set the quantity and item source... didn't set the item id
Embarrassing
b
Its rare to insert lines
Usually you want to set the line at the new lines index
e
My scenario is for work orders. Let's say I'm assembling a table that consist of 4 legs and 1 table top. When the work order is created, we have (3) legs available and (1) top. I want to split the legs component line into a line of Qty 3 and a line of Qty 1 and have the Qty 1 line have an item source of WO so a Work Order is created to make 1 leg.
So I used insertLine with the thought that the components would show Qty 3 Legs (from stock) Qty 1 Leg (from new work order) Qty 1 Table Top (from stock)
z
I would try solve that on the client side(client script)
e
This actually all worked for me once I started setting the ItemId for the inserted line. Unfortunately I can't do this client side as most of our Work Orders are generated from Sales Orders on approval, so the Work Orders aren't made in the UI, just in the back end.