record.delete.promise(options)

Method Description

Deletes a record asynchronously.

Note:

The parameters and errors thrown for this method are the same as those for record.delete(options). For more information about promises, see Promise Object.

Returns

Promise Object

Synchronous Version

record.delete(options)

Supported Script Types

Client scripts

For more information, see SuiteScript 2.x Client Script Type.

Governance

Transaction records: 20 units

Custom records: 4 units

All other records: 10 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 deleting an instance of a standard NetSuite record type, set this value by using the record.Type enum.

  • When deleting 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 | string

required

The internal ID of the record instance to be deleted.

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 promise script example, see Promise Object.

          // Add additional code

// Delete an instance of a standard NetSuite record 
...
function deleteRecord() {
    var deleteRecordPromise = record.delete.promise({
        type: record.Type.PHONE_CALL,
        id: 109
    });
    
    // To delete an instance of a custom record type, use
    // the string ID in the type field. For example:
    // type: 'customrecord_feature'  

    deleteRecordPromise.then(function() {                            
        log.debug({
            title: 'Success',
            details: 'Record successfully deleted' 
        });        
    
        // Add any other needed code that should execute
        // after the record is deleted.    
    }, function(e) {
        log.error({
            title: 'Unable to delete record',
            details: e.name
        });
    });
}
... 
// Add additional code 

        

Related Topics

General Notices