Supported Record Transformations in SuiteScript
Supported record transformations enable automated processes like order management by converting one record type to another.
TL;DR Opening
Supported record transformations allow developers to automate various NetSuite processes by converting records from one type to another. This functionality is invaluable for scenarios like order processing or generating invoices from existing orders.
What Are Supported Transformations?
Using the record.transform method, you can effectively change a record's type while utilizing the existing data from another record. This feature aids in streamlining operations and automating repetitive tasks. For specific transformation types, refer to the section below.
Key Features
- Method Description: Transforms records from one type to another.
- Returns: A transformed record object.
- Script Types Supported: Works with both client and server scripts.
- Governance Limits:
- Transaction records: 10 units
- Custom records: 2 units
- All other record types: 5 units
Parameters for Transformation
The options parameter is critical in defining the transformation specifics. Here are the parameters you need:
| Parameter | Type | Required | Description |
|---|---|---|---|
fromType | string | Required | The current record type being transformed. |
fromId | number | Required | The internal ID of the record to transform. |
toType | string | Required | The record type of the output after transformation. |
isDynamic | boolean | Optional | Sets the transformation to dynamic mode if true (default is false). |
defaultValues | Object | Optional | Name-value pairs for default field values in the new record. |
Errors
You may encounter the following error if any required arguments are not supplied:
- Error Code:
SSS_MISSING_REQD_ARGUMENT- Thrown if a required argument is missing or undefined.
Code Sample
This example demonstrates the basic syntax for transforming a record in SuiteScript:
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
Here is a comprehensive list of the supported transformations:
| Original Record Name | Original Record Type | Transformed Record Name | Transformed Record Type |
|---|---|---|---|
| Assembly Build | assemblybuild | Assembly Unbuild | assemblyunbuild |
| Build/Assembly | assemblyitem | Assembly Build | assemblybuild |
| Work Order | workorder | Cash Refund | cashrefund |
| Cash Sale | cashsale | Credit Memo | creditmemo |
| Customer | customer | Customer Payment | customerpayment |
| Invoice | invoice | Sales Order | salesorder |
| Job | job | Estimate | estimate |
| Purchase Order | purchaseorder | Vendor Bill | vendorbill |
| Custom Sales Transaction | customsalestransaction | Cash Sale | cashsale |
Note: Certain transformations like creating an Assembly Build for Outsourcing Work Orders are not supported. For detailed guidance on other specific transformations, ensure to check the relevant documentation or consult the NetSuite Help Center.
Key Takeaways
- The record transformation feature automates data flow between different record types in NetSuite.
- Understanding the parameters and governance limits can enhance script performance.
- Utilize the provided code samples as a foundation for your custom transformations.
Frequently Asked Questions (4)
Are there specific scripts that support the record transformation method in SuiteScript?
What are the governance limits for using the record.transform method with different record types?
What parameters are required to use the record.transform method in SuiteScript?
What error might occur if required arguments are missing when transforming a 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.
