record.copy(options)

Method Description

Creates a new record by copying an existing record in NetSuite.

Note:

For the promise version of this method, see record.copy.promise(options). Note that promises are only supported in client scripts.

Returns

record.Record

Supported Script Types

Client and server scripts

For more information, see SuiteScript 2.x Script Types.

Governance

Transaction records: 10 units

Custom records: 2 units

All other records: 5 units

Module

N/record Module

Since

2015.2

Parameters
Note:

The options parameter is a JavaScript object.

Parameter

Type

Required / Optional

Description

Since

options.type

string

required

The record type.

Use the following guidelines:

  • When copying an instance of a standard NetSuite record type, set this value by using the record.Type enum.

  • When copying an instance of a custom record type, set this value by using the custom record type’s string ID. For help finding this ID, see Custom Record.

2015.2

options.id

number

required

The internal ID of the existing record instance in NetSuite.

2015.2

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.

2015.2

options.defaultValues

Object

optional

Name-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 Code

Thrown If

SSS_MISSING_REQD_ARGUMENT

A required argument is missing or undefined.

Syntax
Important:

The following code sample shows the syntax for this member. It is not a functional example. For a complete script example, see N/record Module Script Samples.

          // Add additional code
...
var objRecord = record.copy({
    type: record.Type.SALES_ORDER,
    id: 157,
    isDynamic: true,
    defaultValues: {
        entity: 107
    }
});
...
// Add additional code 

        

Related Topics

General Notices