Why does this work: ```var fields = search.look...
# suitescript
j
Why does this work:
Copy code
var fields = search.lookupFields({
	type: 'transaction',
	id: record_id,
	columns: fields
});
But this does not:
Copy code
var fields = search.lookupFields({
	type: record.Type.TRANSACTION,
	id: record_id,
	columns: fields
});
?
s
you should use
search.Type
not
record.Type
whenever using
search
I sometimes mistakenly mix those up myself
not sure that's your root problem, but it is an important distinction ( i.e.
record.Type !== search.Type
)
c
may require you actually specify the type and not a generic "transaction" as it doesn't know what that is
s
It's def what stalbert said, record.Type.TRANSACTION is not a thing
s
Sandii has good point - and notable with TypeScript you'd get a compile time error on that.
j
TRANSACTION is listed as one of the available values under https://netsuite.custhelp.com/app/answers/detail/a_id/45161/kw/record.type
Gotta love incorrect documentation
s
the point here is to use
search.Type
not
record.Type
regardless what what values are or are not available on record.Type, it's the wrong enumeration to use 🙂
s
^
j
yep yep.
s
In general, I don't look at the documentation for the record.Type or search.Type enumeration. I tend to just load
N/record
into chrome console and look through the list there.
s
similarly, in general I just let the TypeScript declaration drive it, since it autocompletes anyway.
message has been deleted