Sublist.getColumn(options)

Method Description

Returns a column in the sublist.

Returns

record.Column

Supported Script Types

Client and server scripts

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

Governance

None

Module

N/record Module

Sibling Object Members

Sublist Object Members

Since

2015.2

Parameters
Note:

The options parameter is a JavaScript object.

Parameter

Type

Required / Optional

Description

Since

options.fieldId

string

required

The internal ID of the column field in the sublist.

See, Finding Internal IDs of Record Fields.

2015.2

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.

Example 1

          // Add additional code
...
var objRecord = record.load({
    type: record.Type.SALES_ORDER,
    id: 275 
});

var objSublist = objRecord.getSublist({
    sublistId: 'item' 
});

var objColumn = objSublist.getColumn({
    fieldId: 'item'
});

if(objColumn.type === 'checkbox'){
    //Perform an action
}
...
// Add additional code 

        

Example 2

This example loops through each line of the items sublist on a sales order record.

          // Add additional code   
...
onRequest: function(context) {
     var recordObj = record.create({type: record.Type.SALES_ORDER});
     var columnList = recordObj.getSublistFields({sublistId: 'item'});
     var sublistObj = recordObj.getSublist({sublistId: 'item'});

     for (var i = 0; i < columnList.length; i++) { 
         var columnId = columnList[i];
         var columnObj = sublistObj.getColumn({fieldId: columnId});
            if (columnObj !== null) {
                log.debug('[Column id] = ' + columnObj.id + ' [Column type] = ' + columnObj.type +  
                ' [Column label] = ' + columnObj.label);
            }
         }
     }
...
// Add additional code 

        

Related Topics

General Notices