Hey all, does anyone know if there is a table/view...
# suiteql
t
Hey all, does anyone know if there is a table/view that is queryable with SuiteQL that would connect the 
internalid
 of native NetSuite records to the table name for that record? E.g. say I have a custbody field that is List/Record of type Customer. If you were to run 
select fieldvaluetyperecord from customfield where upper(scriptid) = upper('custbody_my_cust_field')
 the 
fieldvaluetyperecord
 returned would be 
-2
 which corresponds to Customer. How do you turn that into the fact that the list of options for this custom field would come from the 
customer
 table/view? For custom lists and custom records you can run 
select scriptid from customlist where internalid = [the fieldvaluetyperecord from prior query]
 and then the 
scriptid
 there would be the “table/view” to query for options for the List/Record field. Same thing for a custom record except you query against the 
customrecordtype
 table/view. I have search a good bit and see no way to do this for the native record types though (which should all have negative 
internalid
). I found a SuiteAnswer on running a little client side suitescript hack to build out the list of all the internalid/name pairs. But this hack still just gives the record “Name” not the table/view name to query against. The point is to be able to start with just a field ID — e.g. 
custbody_my_cust_field
 — and from there via SuiteQL/integration sync out of the account all the valid IDs that could be sent as a value for that custom field. The above can accomplish this when the custom field points at a custom list or custom record. But when it points at a native NetSuite record, I seem to be SOL. If anyone has dabbled in this and has some insight that would be much appreciated.
There is a table labeled “Record Type” with table/view name
scriptrecordtype
that seems like it would be exactly what I’m looking for. It returns this type of info:
Copy code
"deploymentname": "Customer",
"name": "Customer",
"internalid": -203,
"skey": "CUSTOMER"
But Customer has
internalid
of
-2
not `-203`… so not sure what info that’s providing. It seems like it should be just what’s needed - the (native) record name, the deployment name if a user renames any of their records, the internalid, and then skey appears to be the table/view name to run a query. But the
internalids
just aren’t correct for what I’m looking for (I assume they’re correct in some other capacity, but)
s
There is certainly a disconnect between the internalid's that table is giving you vs the internal id you are expecting (the record internalid of
-2
refers to other things I believe). As an example,
transaction
has an internalid of
-30
but you will not find transaction in that Record Type Analytics table, the specific transaction types have their own ids instead.
t
Customer record type has an internalid of
-2
. The
scriptrecordtype
table shows this for Customer:
So yeah, that table seems like it should be exactly what I need, except the
internalids
do not match anything I’ve seen for any of the records listed.
Just seems like this should be possible, somehow.
b
the internal id of a customer when used as a record type is -2
the internal id of a customer when used as a scripted record type is -203
getting the internal id of select options is probably easiest using Field.getSelectOptions or getSelectValue