search.createColumn(options)

Note:

The content in this help topic pertains to SuiteScript 2.0.

Method Description

Creates a new search column as a search.Column object.

A search column represents a field on a record. You create a column for each field that you want to include in the search results. For example, if you create a column for the Sales Rep field on a customer record and specify that column when you create a search, the value of the Sales Rep field is included in the search results.

Important:

As you create search columns, consider the following:

  • You cannot directly create a filter or column for a list/record type field in SuiteScript by passing in its text value. You must use the field’s internal ID. If you must use the field’s text value, you can create a filter or column with a formula using name: 'formulatext'.

  • After you create a column, you cannot change the sort order of the column. If you use the same column in another search and specify a new sort order, the previous sort order is still used (the sort order that you specified using the options.sort parameter).

Returns

search.Column

Supported Script Types

Client and server scripts

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

Governance

None

Module

N/search Module

Since

2015.2

Parameters
Note:

The options parameter is a JavaScript object.

Parameter

Type

Required / Optional

Description

Since

options.name

string

Required

Name of the search column. See Column.name.

2015.2

options.join

string

Optional

Join ID for the search column. See Column.join.

2015.2

options.summary

string

Optional

Summary type for the column. See search.Summary and Column.summary.

2015.2

options.formula

string

Optional

Formula for the search column. See Column.formula.

2015.2

options.function

string

Optional

Special function for the search column. See Column.function.

2015.2

options.label

string

Optional

Label for the search column. See Column.label.

2015.2

options.sort

string

Optional

The sort order of the column. Use the search.Sort enum for this argument.

Also see Column.sort.

2015.2

Errors

Error Code

Message

Thrown If

SSS_INVALID_SRCH_COLUMN_SUM

A search.Column object contains an invalid column summary type, or is not in proper syntax: {1}.

The options.summary parameter is not a valid search summary type. See search.Summary.

INVALID_SRCH_FUNCTN

 

An unknown function is provided.

SSS_MISSING_REQD_ARGUMENT

{1}: Missing a required argument: {2}

Required parameter is missing.

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

          //Add additional code 
...
var currencyColumn = search.createColumn({
    name: 'currency',
    sort: search.Sort.ASC
});
...
//Add additional code 

        

Related Topics

N/search Module
SuiteScript 2.x Modules
SuiteScript 2.x

General Notices