record.transform (Turn This Into That The Easy Way)

by | Jun 21, 2022 | Tech Talk

Often clients are looking for ways to simplify their process flow in NetSuite through scripted automation. Some of the most common requests involve generating invoices when each item fulfillment is marked as shipped or automatically creating a sales order from a quote.

To accomplish this, NetSuite provides a very useful API method for the record module known as the record.transform. This method is used to transform a record from one record type into another, bringing forward data from the originating source record.  This behavior replicates the Native NetSuite UI actions of an end user clicking a Next Bill button on the item fulfillment record or clicking the Create Sales Order button on a quote record.

This method is available to both client and server scripts and returns the id of the newly created record when complete.

Below is a table of properties available to the record.transform method:

ParameterTypeRequired / OptionalDescription
options.fromTypestringrequiredThe 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.fromIdnumberrequiredThe internal ID of the existing record instance being transformed.
options.toTypestringrequiredThe record type of the record returned when the transformation is complete.
options.isDynamicbooleanoptionalDetermines 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.
options.defaultValuesObjectoptionalName-value pairs containing default values of fields in the new record. By default, this value is null.

The following code sample is used to create an invoice directly from a sales order.  When the invoice is created, the created from reference on the new document is that of the source transaction that it was transformed from.

// Add additional code
...
var objRecord = record.transform({
fromType: record.Type.SALES_ORDER,
fromId: salesOrderId,
toType: record.Type.INVOICE,
isDynamic: true, 
});		

...
// Add additional code

Below are available transformations within NetSuite.

Original Record NameOriginal Record TypeTransformed Record NameTransformed Record Type
Assembly BuildassemblybuildAssembly Unbuildassemblyunbuild
Build/AssemblyassemblyitemAssembly Buildassemblybuild
Build/AssemblyassemblyitemWork Orderworkorder
Cash SalecashsaleCash Refundcashrefund
Cash SalecashsaleCustom Sales Transactioncustomsalestransaction
Cash SalecashsaleReturn Authorizationreturnauthorization
Credit MemocreditmemoCash Refundcashrefund
CustomercustomerCash Salecashsale
CustomercustomerCustomer Paymentcustomerpayment
CustomercustomerEstimateestimate
CustomercustomerInvoiceinvoice
CustomercustomerOpportunityopportunity
CustomercustomerSales Ordersalesorder
CustomercustomerVendorvendor
Customer DepositcustomerdepositCustomer Refundcustomerrefund
Customer DepositcustomerdepositDeposit Applicationdepositapplication
Customer PaymentcustomerpaymentCustomer Refundcustomerrefund
Customer Payment AuthorizationcustomerpaymentauthorizationCustomer Depositcustomerdeposit
Customer Payment AuthorizationcustomerpaymentauthorizationCustomer Paymentcustomerpayment
Custom Purchase TransactioncustompurchasetransactionCustom Purchase Transactioncustompurchasetransaction
Custom Purchase TransactioncustompurchasetransactionVendor Billvendorbill
Custom Purchase TransactioncustompurchasetransactionVendor Creditvendorcredit
Custom Purchase TransactioncustompurchasetransactionVendor Paymentvendorpayment
Custom Sales TransactioncustomsalestransactionCash Refundcashrefund
Custom Sales TransactioncustomsalestransactionCustomer Paymentcustomerpayment
Custom Sales TransactioncustomsalestransactionCustomer Refundcustomerrefund
Custom Sales TransactioncustomsalestransactionInvoiceinvoice
Custom Sale TransactioncustomsaletransactionCash Salecashsale
Custom Sale TransactioncustomsaletransactionCredit Memocreditmemo
Custom Sale TransactioncustomsaletransactionCustom Sale Transactioncustomsaletransaction
EmployeeemployeeExpense Reportexpensereport
EmployeeemployeeTimetimebill
QuoteestimateCash Salecashsale
QuoteestimateInvoiceinvoice
QuoteestimateSales Ordersalesorder
Intercompany Transfer OrderintercompanytransferorderItem Fulfillmentitemfulfillment
Intercompany Transfer OrderintercompanytransferorderItem Receiptitemreceipt
InvoiceinvoiceCredit Memocreditmemo
InvoiceinvoiceCustomer Paymentcustomerpayment
InvoiceinvoiceCustom Sales Transactioncustomsalestransaction
InvoiceinvoiceReturn Authorizationreturnauthorization
JobjobCash Salecashsale
JobjobEstimateestimate
JobjobInvoiceinvoice
JobjobSales Ordersalesorder
LeadleadOpportunityopportunity
OpportunityopportunityCash Salecashsale
OpportunityopportunityQuoteestimate
OpportunityopportunityInvoiceinvoice
OpportunityopportunitySales Ordersalesorder
ProspectprospectQuoteestimate
ProspectprospectOpportunityopportunity
ProspectprospectSales Ordersalesorder
Purchase OrderpurchaseorderCustom Purchase Transactioncustompurchasetransaction
Purchase OrderpurchaseorderItem Receiptitemreceipt
Purchase OrderpurchaseorderOwnership Transferownershiptransfer
Purchase OrderpurchaseorderVendor Billvendorbill
Purchase OrderpurchaseorderVendor Return Authorizationvendorreturnauthorization
Purchase RequisitionpurchaserequisitionPurchase Orderpurchaseorder
Request For QuoterequestforquoteVendor Request For Quotevendorrequestforquote
Return AuthorizationreturnauthorizationCash Refundcashrefund
Return AuthorizationreturnauthorizationCredit Memocreditmemo
Return AuthorizationreturnauthorizationCustom Sales Transactioncustomsalestransaction
Return AuthorizationreturnauthorizationItem Receiptitemreceipt
Return AuthorizationreturnauthorizationRevenue Commitment Reversalrevenuecommitmentreversal
Revenue ContractrevenuecontractRevenue Commitmentrevenuecommitment
Sales OrdersalesorderCash Salecashsale
Sales OrdersalesorderCustom Sales Transactioncustomsalestransaction
Sales OrdersalesorderFulfillment Requestfulfillmentrequest
Sales OrdersalesorderInvoiceinvoice
Sales OrdersalesorderItem Fulfillmentitemfulfillment
Sales OrdersalesorderReturn Authorizationreturnauthorization
Sales OrdersalesorderRevenue Commitmentrevenuecommitment
Sales OrdersalesorderRevenue Contractrevenuecontract
Sales OrdersalesorderStore Pickup Fulfillmentstorepickupfulfillment
Transfer OrdertransferorderItem Fulfillmentitemfulfillment
Transfer OrdertransferorderItem Receiptitemreceipt
VendorvendorCustomercustomer
VendorvendorPurchase Orderpurchaseorder
VendorvendorVendor Billvendorbill
VendorvendorVendor Paymentvendorpayment
Vendor BillvendorbillCustom Purchase Transactioncustompurchasetransaction
Vendor BillvendorbillVendor Creditvendorcredit
Vendor BillvendorbillVendor Paymentvendorpayment
Vendor BillvendorbillVendor Return Authorizationvendorreturnauthorization
Vendor PrepaymentvendorprepaymentVendor Prepayment Applicationvendorprepaymentapplication
Vendor Request For QuotevendorrequestforquotePurchase Contractpurchasecontract
Vendor Return AuthorizationvendorreturnauthorizationCustom Purchase Transactioncustompurchasetransaction
Vendor Return AuthorizationvendorreturnauthorizationItem Fulfillmentitemfulfillment
Vendor Return AuthorizationvendorreturnauthorizationVendor Creditvendorcredit
Work OrderworkorderAssembly Buildassemblybuild
Work OrderworkorderWork Order Closeworkorderclose
Work OrderworkorderWork Order Completionworkordercompletion
Work OrderworkorderWork Order Issueworkorderissue

If you need any assistance, feel free to get in touch with NetSuite consultants, they will be happy to help you in every way possible.

About Us

We are a NetSuite Solutions Partner and reseller with 30+ years of combined experience.  We specialize in implementation, optimization, integration, rapid project recovery and rescue as well as custom development to meet any business need. If you would like more information on NetSuite or in need of consultation for your project or implementation, feel free to contact NetSuite support.

To Contact Us Click HERE

Join our mailing list to stay up to date on the latest NetSuite solutions.