N/record Default Values for SuiteScript Record Management
N/record module allows setting default values for creating, copying, and loading records in SuiteScript.
The N/record module is crucial for managing NetSuite records, enabling operations such as creation, deletion, copying, and loading of records. This article details how to specify default values when initializing records, which can streamline record handling in your SuiteScript implementations.
How to Use Default Values in N/record
Default values can be specified by using the optional defaultValues parameter in the following APIs:
record.create(options)record.copy(options)record.transform(options)record.load(options)
Supported Initialization Types
The following table lists the initialization types available for SuiteScript-supported records and the corresponding values you can set:
| Record | Initialization Type | Values |
|---|---|---|
| All SuiteScript-supported records | customform | _customformid_ |
| Assembly Build | assemblyitem | _assemblyitemid_ |
| Cash Refund | entity | _entityid_ |
| Cash Sale | entity | _entityid_ |
| Charge Rule | entity | _entityid_ |
| Check | entity | _entityid_ |
| Credit Memo | entity | _entityid_ |
| Customer Payment | entity | _entityid_ |
| Customer Refund | entity | _entityid_ |
| Deposit | disablepaymentfilters | _disablepaymentfilters_ |
| Estimate | entity | _entityid_ |
| Expense Report | entity | _entityid_ |
| Invoice | entity | _entityid_ |
| Item Receipt | entity | _entityid_ |
| Non-Inventory Part | subtype | sale, resale, purchase |
| Opportunity | entity | _entityid_ |
| Purchase Order | entity | _entityid_ |
| Sales Order | entity | _entityid_ |
| Tax Group | nexuscountry | _countrycode_ |
| Tax Type | country | _countrycode_ |
| Vendor Bill | entity | _entityid_ |
| Vendor Payment | entity | _entityid_ |
| Work Order | assemblyitem | _assemblyitemid_ |
Country Codes for Tax Records
When scripting Tax Group or Tax Type records, you can utilize specific country codes. For example:
record.create('taxgroup', {nexuscountry: 'AR'});The country codes are essential for correct initialization. Here’s a brief list of some country codes for reference:
| Country Code | Country Name |
|---|---|
| AD | Andorra |
| AE | United Arab Emirates |
| AR | Argentina |
| CA | Canada |
| DE | Germany |
By utilizing default values and understanding how to initialize records effectively, developers can substantially enhance productivity in their SuiteScript applications.
Key Takeaways
- The N/record module allows customization of default values when managing records.
- Initialization types such as
customer,entity, andcustomformcan streamline record creation processes. - Utilizing country codes can ensure compliance with specific regional requirements in tax-related records.
Frequently Asked Questions (4)
How can I set default values when creating a record using SuiteScript?
Which records support the use of the `entity` initialization type?
Can I specify country codes for tax records in SuiteScript?
What parameter should be used to disable payment filters when loading a Deposit record?
Was this article helpful?
More in SuiteScript
- SuiteScript 2.1 Enhancements in NetSuite February Updates
SuiteScript 2.1 now supports async features and PATCH method. Discover the latest API and SuiteProcurement improvements.
- Scheduling Map/Reduce Script Deployments in NetSuite
Learn to schedule map/reduce script submissions, including one-time and recurring options in NetSuite.
- Binary File Support in N/https Module for SuiteScript
SuiteScript enhances capabilities with binary file support in the N/https module, allowing improved data handling in external communications.
- API Governance Units Calculation in NetSuite 2026.1
NetSuite 2026.1 introduces examples illustrating API governance unit calculations for both user event and scheduled scripts.
