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:
Parameter | Type | Required / Optional | 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. |
options.defaultValues | Object | optional | Name-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 Name | Original Record Type | Transformed Record Name | Transformed Record Type |
Assembly Build | assemblybuild | Assembly Unbuild | assemblyunbuild |
Build/Assembly | assemblyitem | Assembly Build | assemblybuild |
Build/Assembly | assemblyitem | Work Order | workorder |
Cash Sale | cashsale | Cash Refund | cashrefund |
Cash Sale | cashsale | Custom Sales Transaction | customsalestransaction |
Cash Sale | cashsale | Return Authorization | returnauthorization |
Credit Memo | creditmemo | Cash Refund | cashrefund |
Customer | customer | Cash Sale | cashsale |
Customer | customer | Customer Payment | customerpayment |
Customer | customer | Estimate | estimate |
Customer | customer | Invoice | invoice |
Customer | customer | Opportunity | opportunity |
Customer | customer | Sales Order | salesorder |
Customer | customer | Vendor | vendor |
Customer Deposit | customerdeposit | Customer Refund | customerrefund |
Customer Deposit | customerdeposit | Deposit Application | depositapplication |
Customer Payment | customerpayment | Customer Refund | customerrefund |
Customer Payment Authorization | customerpaymentauthorization | Customer Deposit | customerdeposit |
Customer Payment Authorization | customerpaymentauthorization | Customer Payment | customerpayment |
Custom Purchase Transaction | custompurchasetransaction | Custom Purchase Transaction | custompurchasetransaction |
Custom Purchase Transaction | custompurchasetransaction | Vendor Bill | vendorbill |
Custom Purchase Transaction | custompurchasetransaction | Vendor Credit | vendorcredit |
Custom Purchase Transaction | custompurchasetransaction | Vendor Payment | vendorpayment |
Custom Sales Transaction | customsalestransaction | Cash Refund | cashrefund |
Custom Sales Transaction | customsalestransaction | Customer Payment | customerpayment |
Custom Sales Transaction | customsalestransaction | Customer Refund | customerrefund |
Custom Sales Transaction | customsalestransaction | Invoice | invoice |
Custom Sale Transaction | customsaletransaction | Cash Sale | cashsale |
Custom Sale Transaction | customsaletransaction | Credit Memo | creditmemo |
Custom Sale Transaction | customsaletransaction | Custom Sale Transaction | customsaletransaction |
Employee | employee | Expense Report | expensereport |
Employee | employee | Time | timebill |
Quote | estimate | Cash Sale | cashsale |
Quote | estimate | Invoice | invoice |
Quote | estimate | Sales Order | salesorder |
Intercompany Transfer Order | intercompanytransferorder | Item Fulfillment | itemfulfillment |
Intercompany Transfer Order | intercompanytransferorder | Item Receipt | itemreceipt |
Invoice | invoice | Credit Memo | creditmemo |
Invoice | invoice | Customer Payment | customerpayment |
Invoice | invoice | Custom Sales Transaction | customsalestransaction |
Invoice | invoice | Return Authorization | returnauthorization |
Job | job | Cash Sale | cashsale |
Job | job | Estimate | estimate |
Job | job | Invoice | invoice |
Job | job | Sales Order | salesorder |
Lead | lead | Opportunity | opportunity |
Opportunity | opportunity | Cash Sale | cashsale |
Opportunity | opportunity | Quote | estimate |
Opportunity | opportunity | Invoice | invoice |
Opportunity | opportunity | Sales Order | salesorder |
Prospect | prospect | Quote | estimate |
Prospect | prospect | Opportunity | opportunity |
Prospect | prospect | Sales Order | salesorder |
Purchase Order | purchaseorder | Custom Purchase Transaction | custompurchasetransaction |
Purchase Order | purchaseorder | Item Receipt | itemreceipt |
Purchase Order | purchaseorder | Ownership Transfer | ownershiptransfer |
Purchase Order | purchaseorder | Vendor Bill | vendorbill |
Purchase Order | purchaseorder | Vendor Return Authorization | vendorreturnauthorization |
Purchase Requisition | purchaserequisition | Purchase Order | purchaseorder |
Request For Quote | requestforquote | Vendor Request For Quote | vendorrequestforquote |
Return Authorization | returnauthorization | Cash Refund | cashrefund |
Return Authorization | returnauthorization | Credit Memo | creditmemo |
Return Authorization | returnauthorization | Custom Sales Transaction | customsalestransaction |
Return Authorization | returnauthorization | Item Receipt | itemreceipt |
Return Authorization | returnauthorization | Revenue Commitment Reversal | revenuecommitmentreversal |
Revenue Contract | revenuecontract | Revenue Commitment | revenuecommitment |
Sales Order | salesorder | Cash Sale | cashsale |
Sales Order | salesorder | Custom Sales Transaction | customsalestransaction |
Sales Order | salesorder | Fulfillment Request | fulfillmentrequest |
Sales Order | salesorder | Invoice | invoice |
Sales Order | salesorder | Item Fulfillment | itemfulfillment |
Sales Order | salesorder | Return Authorization | returnauthorization |
Sales Order | salesorder | Revenue Commitment | revenuecommitment |
Sales Order | salesorder | Revenue Contract | revenuecontract |
Sales Order | salesorder | Store Pickup Fulfillment | storepickupfulfillment |
Transfer Order | transferorder | Item Fulfillment | itemfulfillment |
Transfer Order | transferorder | Item Receipt | itemreceipt |
Vendor | vendor | Customer | customer |
Vendor | vendor | Purchase Order | purchaseorder |
Vendor | vendor | Vendor Bill | vendorbill |
Vendor | vendor | Vendor Payment | vendorpayment |
Vendor Bill | vendorbill | Custom Purchase Transaction | custompurchasetransaction |
Vendor Bill | vendorbill | Vendor Credit | vendorcredit |
Vendor Bill | vendorbill | Vendor Payment | vendorpayment |
Vendor Bill | vendorbill | Vendor Return Authorization | vendorreturnauthorization |
Vendor Prepayment | vendorprepayment | Vendor Prepayment Application | vendorprepaymentapplication |
Vendor Request For Quote | vendorrequestforquote | Purchase Contract | purchasecontract |
Vendor Return Authorization | vendorreturnauthorization | Custom Purchase Transaction | custompurchasetransaction |
Vendor Return Authorization | vendorreturnauthorization | Item Fulfillment | itemfulfillment |
Vendor Return Authorization | vendorreturnauthorization | Vendor Credit | vendorcredit |
Work Order | workorder | Assembly Build | assemblybuild |
Work Order | workorder | Work Order Close | workorderclose |
Work Order | workorder | Work Order Completion | workordercompletion |
Work Order | workorder | Work Order Issue | workorderissue |
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