module function · N/record
transform()
record.transform(options)
Transforms a record from one type into another, using data from an existing record.
- Implementation
- Implemented published in npm 0.0.1
- Design
- Accepted
transform T(id) to U
1record.transform({2 fromType: /* string, required */,3 fromId: /* number, required */,4 toType: /* string, required */,5 isDynamic: /* boolean, optional */6});
| Parameter | Type | Required | Description |
|---|---|---|---|
| options.fromType | string | required | The record type of the existing record instance being transformed. This value sets the Record.type property for the record. This property is read-only and cannot be changed after the record is loaded. Set this value using the record.Type . |
| options.fromId | number | required | The internal ID of the existing record instance being transformed. |
| options.toType | string | required | The record type of the record returned when the transformation is complete. |
| options.isDynamic | boolean | optional | Determines whether the new record is created in dynamic mode. If set to true , the new record is created in dynamic mode. If set to false , the new record is created in standard mode. By default, this value is false . Note: For additional information about standard and dynamic mode, see record.Record and SuiteScript 2.x Standard and Dynamic Modes . |
Supported syntax · compiles today
let invoice = transform SalesOrder(42) to Invoice
1const invoice = record.transform({2 fromType: record.Type.SALES_ORDER,3 fromId: 42,4 toType: record.Type.INVOICE5});
NetSuite allows only certain source and target pairs. Mynt does not check the pair, so an unsupported one fails at runtime. dynamic after it holds the record in dynamic mode, isDynamic: true (in the compiler, not yet published). Published on npm since 0.0.1. Numeric ids, as shown, since 0.1.0; 0.0.1 took the id as text, Customer("123"). Verified with mynt build on 13 Oct 2026.
Competing syntax for transform, from GitHub Discussions. Select two or more to compare them side by side, with the syntax Mynt supports today as a baseline.
let invoice = transform SalesOrder(42) to InvoiceLoading proposals from GitHub…
Write the Mynt you wish you could write.
A good proposal shows the syntax, the SuiteScript it should become, and argues for it: why it is clearer, how it fits the rest of the language, what it makes harder.
- Clarity. Does it say what happens, without ceremony?
- Consistency. Does it read like
load,saveandRef[field]? - Expressiveness. Does it cover the cases people actually write?
- Honesty. Does it hide a NetSuite cost, such as governance, that a reader should see?