https://netsuiteprofessionals.com logo
k

KnotKnick

03/28/2022, 8:01 PM
Hello! If I have the
line
id of a sales order line (not the line number), is it possible to update the line without having to loop through the sublist?
c

creece

03/28/2022, 8:11 PM
yeah setSublistValue takes the line as a param so you can just use salesOrderRecord.setSublistValue({fieldId: 'yourfieldid', value: 'yourvalue', line: 'yourline'});
k

KnotKnick

03/28/2022, 8:13 PM
but doesn't that take the sequential line number NOT the line id (order line id)?
c

creece

03/28/2022, 8:14 PM
sorry line id not not line
you want lineuniquekey if you're gonna do that
a

Azi

03/28/2022, 8:15 PM
Even if your know the lineunique key, you will still need to find in your sublist which line that is sequentially
c

creece

03/28/2022, 8:16 PM
findSublistLineWithValue and using the lineuniquekey is what i'd use.. i guess its sequential behind the scenes
so no, you can't use line as its not unique enough
k

KnotKnick

03/28/2022, 8:21 PM
so do need to loop through the sublist to find that line right?
s

Shawn Talbert

03/28/2022, 8:31 PM
_<http://.fi|.fi>nd(so.item, l=> l.lineuniquekey = ='theId')
c

creece

03/28/2022, 8:43 PM
its 2 part if you use findSublistLineWithValue. First get the line using the method and then set the value of whatever line it returns if its valid. YOU do not need to do any looping yourself.
k

KnotKnick

03/28/2022, 9:19 PM
got it, thank you for your response!