i think we've talked about it before, but given th...
# suitescript
s
i think we've talked about it before, but given the time i just wasted, maybe it's worth saying again.
search.lookupFields
returns (potentially) incorrect text/value pairs for a multiselect field. the array contains the correct ids, but the text/value association is (potentially) wrong. The texts are ordered alphabetically (as they are in the UI) but the values are ordered numerically as well, regardless of their actual association. so the lowest id is associated with the first alphabetical entry:
Copy code
>search.lookupFields({
	type : 'customrecord_g2_category',
	id : 928,
	columns : [ 'custrecord_g2_category_condition_refs' ]
})['custrecord_g2_category_condition_refs']

<(5) [{…}, {…}, {…}, {…}, {…}]
	0: {value: "302", text: "Above Average 9.0"}
	1: {value: "401", text: "Average 8.0"}
	2: {value: "501", text: "Below Average 7.0"}
	3: {value: "601", text: "Mint 9.5"}
	4: {value: "604", text: "Poor 6.0"}
	length: 5
	__proto__: Array(0)

>search.lookupFields({
	type: 'customrecord_g2_condition',
	id: 302,
	columns: ['name']})['name']
<"Below Average 7.0"

>search.lookupFields({
	type: 'customrecord_g2_condition',
	id: 501,
	columns: ['name']})['name']
<"Mint 9.5"
.
.
.
👎🏼 2