Record Transformation Method in SuiteScript 2.x
The record transformation method allows you to convert records between types, streamlining order processing and invoice creation.
The record transformation method in SuiteScript 2.x enables developers to transform one type of record into another, leveraging existing record data. This capability is particularly useful for automating processes such as order processing and the creation of item fulfillment transactions and invoices.
How Does the Record Transformation Method Work?
Transforming a record requires specifying certain parameters. The method provides both synchronous and promise-based (asynchronous) variants. The promise version can be particularly beneficial in client scripts where asynchronous processing is preferred.
Method Description
- Functionality: The method transforms a record of one type into another using the data from an existing record.
- Returns: A new record object.
Governance
- Transaction Records: 10 units.
- Custom Records: 2 units.
- All Other Record Types: 5 units.
Supported Script Types
This method can be utilized in both client and server scripts. For a detailed overview of SuiteScript 2.x script types, refer to the SuiteScript 2.x Script Types documentation.
Parameters
The method accepts an options parameter which is a JavaScript object containing the following fields:
| Field Name | Type | Required / Optional | Description |
|---|---|---|---|
fromType | string | Required | The record type of the existing record instance being transformed. This value sets the Record.type property for the record and is read-only. |
fromId | number | Required | The internal ID of the existing record instance being transformed. |
toType | string | Required | The record type of the new record that will be returned after the transformation. |
isDynamic | boolean | Optional | Determines if the new record is created in dynamic mode. Defaults to false. |
defaultValues | Object | Optional | Name-value pairs for default values of fields in the new record. |
Error Handling
You may encounter the following error:
SSS_MISSING_REQD_ARGUMENT: Thrown if a required argument is missing or undefined.
Example Syntax
Here’s how you might implement the transformation method:
1var objRecord = record.transform({2 fromType: record.Type.CUSTOMER,3 fromId: 107,4 toType: record.Type.SALES_ORDER,5 isDynamic: true,6});1record.transform({2 fromType: 'salesorder', 3 fromId: 6, 4 toType: 'invoice', 5 defaultValues: { billdate: '01/01/2019' }6});Supported Transformation Types
The record transformation method supports a variety of transformation types. Here are some noteworthy examples:
- Assembly Build: converts to Assembly Unbuild.
- Cash Sale: can transform into Credit Memo, Invoice, and more.
- Vendor Bill: can convert into Vendor Credit or Vendor Payment.
For a full list of supported transformations and their corresponding record types, check the documentation.
Conclusion
Understanding the nuances of record transformation in SuiteScript 2.x is crucial for effectively utilizing NetSuite's automation capabilities. This knowledge not only aids in improving efficiency but also enhances the accuracy of record management within your applications.
Source: This article is based on Oracle's official NetSuite documentation.
Frequently Asked Questions (4)
Can the record transformation method be used in both client and server scripts in SuiteScript 2.x?
What happens if a required parameter is missing when using the record transformation method?
What are the governance units associated with transforming transaction records using SuiteScript 2.x?
Is it possible to transform a Cash Sale into an Invoice using the record transformation method?
Was this article helpful?
More in Integration
- Natural Language Queries in NetSuite AI
MCP Standard Tools SuiteApp enables AI-driven data tasks in NetSuite, aligned with role permissions.
- Square Connector Integration in NetSuite 2026.1
Discover the Square Connector for seamless integration with NetSuite 2026.1, synchronizing transactions, orders, and inventory effortlessly.
- SuiteTalk Web Services Updates for NetSuite Integrations
SuiteTalk Web Services adds new Item Supply Plan support, enhancing integrations for efficient data management.
- SuiteTalk Web Services Enhancements in NetSuite
Explore the latest enhancements to SuiteTalk Web Services, improving integration and API functionalities in NetSuite.
Advertising
Reach Integration Professionals
Put your product in front of NetSuite experts who work with Integration every day.
Sponsor This Category