Is there any way to find the record type numerical...
# suitescript
m
Is there any way to find the record type numerical id based on the record type name id, and the other way around, like “account <--> -112”?
n
Are you asking for the internal id of a custom record? (i.e. the definition of it not an instance of the custom record)
I suspect you mean the standard NS records since you gave "account" as an example.
b
its more common when using suitetalk, where you basically use a lookup on the Internal IDs for NetSuite Record Types
if you wanted it to be dynamic, then 2.3.5 Transient Record Controller from the SAFE guide can work for numbers to ids
w
@battk OT, Based on the Transient Record Controller example, wouldn't be faster to use a SuiteQL nowadays? The document is dated 2022 but this part is probably older then that.
b
there are 2 tables relating to record types, one is actual Record Types, the other is Scripted Record Types, they have different ids
workbook data source has both tables, but no relation between them
@Madelene Sköld requires a relation between the two tables, the id
account
is a value in the scripted record types, while
-112
is a value in the record types
thats where you can use the transient record controller, which uses field sourcing, where there is actually a relationship between the two tables/lists
m
Exactly, so the relation between the internal ids and the references of different record types, not instances of the records themselves. My colleague just found two tables that seem to be possible to query through SuiteQL to retrieve this relation, joining the “name” columns, but there is no documented join between the tables so we were wondering if you can possibly see a situation where the name in one doesn’t match the name in the second? The tables are ScriptRecordType and ScriptCustomRecordType, and an example of the query for account would be
Copy code
select * from ScriptRecordType
join ScriptCustomRecordType
on ScriptRecordType.name = ScriptCustomRecordType.name
where ScriptRecordType.skey = upper('account')
I tried the transient record controller option (great tip in general by the way, thanks!) and I was able to retrieve the internal id with “RECORD” prepended, so in this case, I got “RECORD-112". Since removing the RECORD part of it is easily done, this is definitely an option as well!
b
depends on how good a solution you need, nothing is preventing a custom record from being named the same as a standard record
or even a standard record being renamed the same as anothe record
its also possible for 2 custom records to have the same name via translations, but thats extra unlikely unless someone is trying to cause a failure
for the transient record controller, you are looking at the wrong field if you are getting Record-112, you should be looking at the List/Record field instead
you will also want to double check how transaction, entities, and items share record types
for example, a sales order scripted record type doesnt have a matching sales order record type
there is only a shared transaction record type
m
I discovered the issue with items, transactions etc as well, so I think I’ll have to go about this issue a whole nother way… But thank you for the input and the indirect confirmation that this is messy and best to stay away from if possible