Select a Sublist Line

We can use record.selectLine(options) to select a sublist line.

Method DescriptionSelects an existing line in a sublist. (dynamic mode only) When working in standard mode, set a sublist field using Record.setSublistValue(options).
Returnsrecord.Record
Supported Script TypesClient and server scripts
GovernanceNone
ModuleN/record Module
Sibling Object MembersRecord Object Members
Parameters
ParameterTypeRequired / OptionalDescription
options.sublistIdstringrequiredThe internal ID of the sublist.This value is displayed in the Records Browser.
options.linenumberrequiredThe line number to select in the sublist. Note that line indexing begins at 0 with SuiteScript 2.0.
Errors
Error CodeThrown If
SSS_INVALID_SUBLIST_OPERATIONA required argument is invalid or the sublist is not editable.
SSS_MISSING_REQD_ARGUMENTA required argument is missing or undefined.
Syntax
// Add additional code.
...
var lineNum = objRecord.selectLine({
    sublistId: 'item',
    line: 3
});
...
// Add additional code.
Example
// Load the Sales Order record
let salesOrderRecord = record.load({
                type: record.Type.SALES_ORDER,
                id: salesOrderId, //Internal id of the sales order
                isDynamic: true           
});

// Select the first line in the 'item' sublist
salesOrderRecord.selectLine({
                sublistId: 'item',
                line: 0
});

Leave a comment

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