I am running a dataset in suitescript using N/data...
# ask-stanley-ai
j
I am running a dataset in suitescript using N/dataset, but some of the columns such as accounting period are being returned as internal IDs instead of their display values. How can I return the display values?
c
AI generated answer (using internal Slack threads):
When you are running a dataset in SuiteScript using N/dataset, some of the columns such as accounting period are returned as internal IDs because that's how NetSuite stores and retrieves data. However, you can get the display values by loading the record and getting the text of the field. Here's a sample code snippet:
Copy code
javascript
var record = recordModule.load({
    type: 'transaction', 
    id: yourRecordId
});

var accountingPeriodText = record.getText({
    fieldId: 'accountingperiod'
});
In this code,
recordModule
is an instance of the
N/record
module,
yourRecordId
is the internal ID of the record you're working with, and
accountingperiod
is the field ID of the Accounting Period field. The
getText
method returns the display value of the field. Please note that this method requires you to load the entire record, which may not be efficient if you're working with a large number of records. In that case, you might want to consider using a search instead, which can return both the internal ID and the display value of a field. ****** 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.810867488
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.804691792
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.802395761
Please provide your feedback on this answer.