Record Transformation Method for SuiteScript Automation
Utilize the record transformation method in SuiteScript to automate order processing, invoice creation, and more.
TL;DR Opening
The record transformation method in SuiteScript allows for the conversion of one record type into another, facilitating automation in order processing, invoice creation, and item fulfillment transactions. This method is essential for integrating workflows within NetSuite effectively.
Understanding Record Transformation
The record.transform(options) method provides developers a way to convert records from one type to another. This capability is particularly useful in automating various tasks such as creating invoices or item fulfillment transactions based on existing order records.
For example, if you want to create a sales order from a customer record or generate an invoice from an existing sales order, this method simplifies the process significantly.
Method Description
record.transform() is used as follows:
- Purpose: This method transforms an existing record type into a new record type by using data from the original record.
- Supported Transformations: There are numerous supported transformations, including creating invoices from sales orders and generating cash refunds from cash sales.
Returns
This method returns an instance of a record.Record object, which represents the transformed record.
Supported Script Types
The transformation method can be utilized in both client and server scripts, allowing flexibility in how scripts can be executed within the NetSuite environment.
Governance
Utilization of this method incurs governance limits based on the type of record being transformed:
- Transaction Records: 10 units
- Custom Records: 2 units
- All Other Record Types: 5 units
Parameters
The options parameter is a JavaScript object that comprises:
| Parameter | Type | Required/Optional | Description |
|---|---|---|---|
fromType | string | required | The record type of the existing record instance being transformed. |
fromId | number | required | The internal ID of the existing record instance being transformed. |
toType | string | required | The record type of the resulting record after transformation. |
isDynamic | boolean | optional | Determines if the new record is created in dynamic mode. Default is false. |
defaultValues | Object | optional | Name-value pairs for default values of fields in the new record. |
Errors
If an error occurs, the typical error thrown is:
SSS_MISSING_REQD_ARGUMENT: This indicates that a required argument is missing or undefined.
Syntax
Here are code samples demonstrating the syntax for transforming records:
Example 1 - Transforming a Customer to Sales Order
1var objRecord = record.transform({2 fromType: record.Type.CUSTOMER,3 fromId: 107,4 toType: record.Type.SALES_ORDER,5 isDynamic: true,6});Example 2 - Transforming a Sales Order to Invoice
1record.transform({ 2 fromType:'salesorder', 3 fromId: 6, 4 toType: 'invoice', 5 defaultValues: {6 billdate: '01/01/2019'} 7});Supported Transformation Types
The following table lists the supported record transformations:
| Original Record Name | Original Record Type | Transformed Record Name | Transformed Record Type |
|---|---|---|---|
| Assembly Build | assemblybuild | Assembly Unbuild | assemblyunbuild |
| Cash Sale | cashsale | Credit Memo | creditmemo |
| Customer | customer | Customer Payment | customerpayment |
| Sales Order | salesorder | Invoice | invoice |
| Purchase Order | purchaseorder | Item Receipt | itemreceipt |
Who This Affects
- Developers using SuiteScript for record management.
- Administrators looking to automate workflows efficiently.
Key Takeaways
- The
record.transform()method automates converting record types. - It supports multiple record transformations, streamlining business processes.
- Understanding parameter governance is crucial to avoid performance issues.
Source: This article is based on Oracle's official NetSuite documentation.
Frequently Asked Questions (4)
What are the supported script types for the record transformation method in SuiteScript?
What governance limits apply when using the record transformation method?
How does the `record.transform()` method handle missing arguments?
Can `record.transform()` create a sales order from a customer record?
Was this article helpful?
More in General
- Payment Date Prediction Feature in NetSuite
Payment Date Prediction in NetSuite utilizes machine learning to enhance financial planning by predicting invoice payment dates.
- NetSuite Ship Central Enhancements for Packing & Shipping
NetSuite Ship Central features enhance packing and shipping operations for improved efficiency and accuracy.
- New Role Setup for NetSuite AI Connector Service in 2026.1
The 2026.1 release adds a new role requirement for the NetSuite AI Connector Service, streamlining custom tool development.
- Generative AI Features in NetSuite 2026.1
Discover new generative AI features in NetSuite 2026.1, enhancing reporting, search, predictions, and development productivity.
Advertising
Reach General Professionals
Put your product in front of NetSuite experts who work with General every day.
Sponsor This Category