CurrentRecord.moveLine(options)

Note:

The content in this help topic pertains to SuiteScript 2.0.

Method Description

Moves one line of the sublist to another location.

The sublist machine must allow moving lines, for example: editmachine.setAllowMoveLines(true);.

The sublist must contain the _sequence field. The sublist type must be edit machine.

When using this method, the order of the other lines is preserved.

Returns

currentRecord.CurrentRecord

Supported Script Types

Client and server scripts

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

Governance

None

Module

N/currentRecord Module

Sibling Object Members

CurrentRecord Object Members

Since

2020.2

Parameters
Note:

The options parameter is a JavaScript object.

Parameter

Type

Required / Optional

Description

Since

options.sublistId

string

required

The internal ID of the sublist.

This value is displayed in the Records Browser. For more information, see Working with the SuiteScript Records Browser.

2020.2

options.from

number

required

The line number to move from. Note that line indexing begins at 0 with SuiteScript 2.0.

2020.2

options.to

number

required

The line number to move to. Note that line indexing begins at 0 with SuiteScript 2.0.

2020.2

Errors

Error Code

Thrown If

SSS_INVALID_SUBLIST_OPERATION

A required argument is invalid or the sublist is not editable.

SSS_MISSING_REQD_ARGUMENT

A required argument is missing or undefined.

SSS_NOT_YET_SUPPORTED

You are trying to move other than the current line.

SSS_SUBLIST_DOESNT_SUPPORT_MOVING_LINES

Moving of lines is not supported.

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/currentRecord Module Script Samples.

          // Add additional code.
...
r.moveLine(sublistId, 2, 0);
logMessage('After moveLine(sublistId, 2, 0)');
logState(r);

r.moveLine({
    sublistId: sublistId,
    from: 0,
    to: 1
});
logMessage('After moveLine({sublistId:sublistId, from:0, to:1})');
logState(r)
...
// Add additional code. 

        

Related Topics

currentRecord.CurrentRecord
N/currentRecord Module
SuiteScript 2.x Modules
SuiteScript 2.x

General Notices