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
- Common SuiteScript Errors and Solutions for NetSuite
Common NetSuite script errors include INVALID_SCRIPT_DEPLOYMENT_ID and SSS_AUTHORIZATION_HEADER_NOT_ALLOWED. Learn effective solutions.
- Set Sublist Field Values in SuiteScript 2.x for Record Management
Set sublist field values in SuiteScript 2.x for effective record management using standard and dynamic modes.
- Setting Field Values in SuiteScript for Effective Record
Learn to set field values in SuiteScript effectively, troubleshooting common errors and understanding data types.
- SuiteScript 2.1 Enhancements and API Updates in NetSuite
SuiteScript 2.1 enables execution of 2.0 scripts and supports PATCH method for enhanced API capabilities.
Advertising
Reach SuiteScript Professionals
Put your product in front of NetSuite experts who work with SuiteScript every day.
Sponsor This Category