Record Transformation Method in SuiteScript 2.x
The record transformation method in SuiteScript 2.x enables developers to convert one record type into another efficiently, optimizing workflows.
The record transformation method allows developers to convert one record type into another by utilizing data from an existing record. This function is particularly useful for automating tasks such as order processing, creation of item fulfillment transactions, and generating invoices from orders.
What Are the Supported Transformation Types?
This method supports various transformations. Below are examples of transformations you can perform:
| 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 Payment | customerpayment | Invoice | invoice |
| Vendor Bill | vendorbill | Vendor Payment | vendorpayment |
| Work Order | workorder | Assembly Build | assemblybuild |
Note: Be aware that some transformations like creating an Assembly Build for an Outsourcing Work Order are not supported through SuiteScript.
How to Use the Method
Parameters
To use the method, you will pass an options parameter, which is a JavaScript object that includes the following:
| Parameter | Type | Required / Optional | Description |
|---|---|---|---|
fromType | string | required | Specifies the record type of the existing record you wish to transform. |
fromId | number | required | Indicates the internal ID of the existing record to be transformed. |
toType | string | required | Defines the record type of the record that will be returned once the transformation is complete. |
isDynamic | boolean | optional | Set to true for dynamic mode or false for standard mode (default is false). |
defaultValues | Object | optional | Allows you to specify default field values for the new record. Defaults to null. |
Example Code
Here are some code examples that demonstrate how to use the record.transform 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: {6 billdate: '01/01/2019'} });Error Handling
Be prepared to catch errors using the following code:
SSS_MISSING_REQD_ARGUMENT: This error is thrown if a required argument is missing or undefined.
Best Practices
- Before performing transformations, always verify that the original record type and values are correct to avoid runtime errors.
- Utilize the dynamic mode cautiously, ensuring that values are set in the same order as in the UI for accurate results.
Who This Affects
This feature is particularly relevant for:
- Developers: Automating workflows and improving script efficiency.
- Administrators: Managing and overseeing record transformation processes and related customizations.
Key Takeaways
- The
record.transformmethod streamlines the process of transforming records such as sales orders into invoices. - Supports various record types and provides options for default values and mode configurations.
- Ensure proper error handling to manage required parameters effectively.
Source: This article is based on Oracle's official NetSuite documentation.
Frequently Asked Questions (4)
What permissions are required to use the record transformation method in SuiteScript 2.x?
Can I perform a record transformation from an Outsourcing Work Order to an Assembly Build using SuiteScript?
How should errors be handled when using the record transformation method in SuiteScript 2.x?
Is dynamic mode mandatory when 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