Supported Record Transformations in SuiteScript 2023.2
Supported record transformations automate processes in NetSuite 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
- 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