record.transform(options)

Transforms a record from one type into another, using data from an existing record. You can use this method to automate order processing, creating item fulfillment transactions and invoices off of orders.

Returnsrecord.Record
Supported Script TypesClient and server scripts
GovernanceTransaction records: 10 units
Custom records: 2 units
All other record types: 5 units
ModuleN/record Module

Parameters:

ParameterTypeRequired / OptionalDescriptionSince
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.2015.2
options.fromIdnumberrequiredThe internal ID of the existing record instance being transformed.2015.2
options.toTypestringrequiredThe record type of the record returned when the transformation is complete.2015.2
options.isDynamicbooleanoptionalDetermines whether the new record is created in dynamic mode.2015.2
options.defaultValuesObjectoptionalName-value pairs containing default values of fields in the new record.By default, this value is null.For a list of available record default values, see N/record Default Values in the NetSuite Help Center.2015.2

Errors:

Error CodeThrown If
SSS_MISSING_REQD_ARGUMENTA required argument is missing or undefined.

Syntax:

// Add additional code.
...
record.transform({ 
   fromType:'salesorder', 
   fromId: 6, 
   toType: 'invoice', 
   defaultValues: {
   billdate: '01/01/2019'} 
});
...
// Add additional code. 

        

Leave a comment

Your email address will not be published. Required fields are marked *