N/record Default Values for SuiteScript Record Management

N/record module allows setting default values for creating, copying, and loading records in SuiteScript.

·2 min read·View Oracle Docs

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:

RecordInitialization TypeValues
All SuiteScript-supported recordscustomform_customformid_
Assembly Buildassemblyitem_assemblyitemid_
Cash Refundentity_entityid_
Cash Saleentity_entityid_
Charge Ruleentity_entityid_
Checkentity_entityid_
Credit Memoentity_entityid_
Customer Paymententity_entityid_
Customer Refundentity_entityid_
Depositdisablepaymentfilters_disablepaymentfilters_
Estimateentity_entityid_
Expense Reportentity_entityid_
Invoiceentity_entityid_
Item Receiptentity_entityid_
Non-Inventory Partsubtypesale, resale, purchase
Opportunityentity_entityid_
Purchase Orderentity_entityid_
Sales Orderentity_entityid_
Tax Groupnexuscountry_countrycode_
Tax Typecountry_countrycode_
Vendor Billentity_entityid_
Vendor Paymententity_entityid_
Work Orderassemblyitem_assemblyitemid_

Country Codes for Tax Records

When scripting Tax Group or Tax Type records, you can utilize specific country codes. For example:

suitescript
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 CodeCountry Name
ADAndorra
AEUnited Arab Emirates
ARArgentina
CACanada
DEGermany

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, and customform can streamline record creation processes.
  • Utilizing country codes can ensure compliance with specific regional requirements in tax-related records.

Source: This article is based on Oracle's official NetSuite documentation.

Frequently Asked Questions (4)

How can I set default values when creating a record using SuiteScript?
You can set default values by using the optional `defaultValues` parameter in the `record.create(options)` API of the N/record module.
Which records support the use of the `entity` initialization type?
Records that support the `entity` initialization type include Cash Refund, Cash Sale, Charge Rule, Check, Credit Memo, Customer Payment, Customer Refund, Deposit, Estimate, Expense Report, Invoice, Item Receipt, Non-Inventory Part, Opportunity, Purchase Order, Sales Order, Vendor Bill, and Vendor Payment.
Can I specify country codes for tax records in SuiteScript?
Yes, when scripting Tax Group or Tax Type records, you can use specific country codes like 'AR' for Argentina or 'CA' for Canada by setting the parameters such as `nexuscountry`.
What parameter should be used to disable payment filters when loading a Deposit record?
When loading a Deposit record, you can use the `disablepaymentfilters` parameter with `_disablepaymentfilters_` as its value in your SuiteScript.
Source: N/record Default Values Oracle NetSuite Help Center. This article was generated from official Oracle documentation and enriched with additional context and best practices.

Was this article helpful?

More in General

View all General articles →