The getSublistValue & getSublistText return th...
# suitescript
m
The getSublistValue & getSublistText return the internal Id of the item. I'm after the item name - what function is required?
Copy code
var component_item_name = rec.getSublistText({
    sublistId: 'component',
    fieldId: 'item',
    line: x
});
b
will depend on the record, but the safe bet is usually to inspect the record in a debugger/console
m
Tried this in console and it too returned an internal ID:
Copy code
require(['N/currentRecord'], function(currentRec){
	var rec = currentRec.get()
	console.log(rec.getSublistText("component","item", 0))
});
b
log the record, not your output
Copy code
require(["N/record"], function (record) {
  console.log(record.load({ type: "assemblybuild", id: "29431" }).toJSON());
});
m
I tried using '*compitemname'* instead of 'item' but that just returned undefined. The compitemname has the text value I require
b
you may just have to deal with looking up the names
m
How do you mean?
b
do a search or query to lookup the names from the internal id
avoid the beginner mistake of using lookupFields for each line
👍 1
m
I see - I had that in mind but was hoping to avoid it. So I could build a saved search with all the items and do a lookup on the internal id and retrieve the item name.
b
ideally you filter it so you only get the items in your component sublist
honestly its probably worse getting all the items than it is doing one lookup per line