Is there a way to look up enum type for a record
# ask-stanley-ai
r
Is there a way to look up enum type for a record
c
AI generated answer (using internal Slack threads):
Yes, there is a way to look up the enum type for a record in NetSuite. For custom records, you can hardcode the script id of the custom record. For standard records, you can use the
record.Type
or
search.Type
to get the record type. For example, if you have a record and you want to determine its type, you can use
context.newRecord.type
in SuiteScript 2.0. If you are dealing with items that could be of different types (like assembly items, inventory items, or kit items), you can use the
search.lookupFields
function to get the record type. Here is an example:
Copy code
javascript
search.lookupFields({ id : XXXXX, type : search.Type.ITEM, columns : 'recordtype' })
This will return the true 'recordtype' value which you can then use to load the record by Type etc. If you need to get the scriptable id of a "RecordType", you can refer to the Schema Browser under platform->core where RecordType is defined as an Enum. However, if you need to use SuiteScript to get this information, you might need to create a custom record and use sourcing to get the values. ****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ******
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.805900753
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.805402577
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.802601814
Please provide your feedback on this answer.