Hi Guys, Lets say I have a sales order with 300 li...
# suitescript
k
Hi Guys, Lets say I have a sales order with 300 line items, and the line item is in SKU format. Right now I am looping through 300 lines, then use search module to retrieve each line item's internal ID. Is there a more efficiently way than to run search for these 300 lines? They are all distinct SKU per line, no duplicate
e
Some context is missing. When do you need the SKU? On transaction save? On a report?
e
Sounds like a user event or client script. Either way,
getSublistValue
should return the actual internal id of the line item. So the SKU shows on screen on the line, but the actual value is the internal id.
getSublistValue({ fieldId: 'item', sublistId: 'item', line: i })
should give you the internal id.
getSublistText({ fieldId: 'item', sublistId: 'item', line: i })
should give you the SKU
k
@Edgar Valdes @ec I am trying to create sales order into Netsuite. I apologized, I had forgotten to mention I'm using Restlet . I am syncing orders into Netsuite, and the orders from external service only has SKU
e
@Ken you shouldn’t need to look up the internal id. you can enter the data using
setSublistText
instead of
setSublistValue
. Share some code. Note:
setSublistText
requires a
"text"
parameter to be set, as opposed to
"value"
which is the norm an you’re probably used to in 2.x
👍 1
k
Okay thank you!
@ec My SKU is currently the ITEM Name, therefore I do see subListText work.
e
👍
k
@ec i stumble upon a new issue, how can i use subListText using Matrix item?
I'm only provided with the child SKU