Hello! If I have the `line` id of a sales order li...
# suitescript
k
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
yeah setSublistValue takes the line as a param so you can just use salesOrderRecord.setSublistValue({fieldId: 'yourfieldid', value: 'yourvalue', line: 'yourline'});
k
but doesn't that take the sequential line number NOT the line id (order line id)?
c
sorry line id not not line
you want lineuniquekey if you're gonna do that
a
Even if your know the lineunique key, you will still need to find in your sublist which line that is sequentially
c
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
so do need to loop through the sublist to find that line right?
s
_<http://.fi|.fi>nd(so.item, l=> l.lineuniquekey = ='theId')
c
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
got it, thank you for your response!