Column Object Members in SuiteScript 2.1 for Searches

Column objects encapsulate search columns in SuiteScript 2.1, allowing effective data retrieval and manipulation in NetSuite search operations.

·3 min read·View Oracle Docs

Starting with SuiteScript 2.1, the Column object facilitates the creation and management of search columns in NetSuite searches, enhancing data retrieval and manipulation capabilities for scripts.

Overview of the Column Object

The Column object in the N/search module encapsulates a single search column, allowing developers to define how data is fetched and structured in search results. This object can be created using the method search.createColumn(options) and can be included in a search.Search object during search creation or loading.

Key Features of the Column Object

  • Encapsulation: The Column object encapsulates the properties and methods for defining search columns.
  • Customizability: Users can utilize the various methods and properties to adjust column settings, such as applying formulas or defining sorting behavior.
  • Integration with Result Objects: Many search result processing methods can utilize Column objects directly, enhancing flexibility and convenience in handling search results.

Column Object Members

Here’s a quick overview of the available members (methods and properties) associated with the Column object:

Member TypeNameReturn Type / Value TypeSupported Script TypesDescription
MethodColumn.setWhenOrderedBy()search.ColumnClient and server scriptsDetermines the column from which the minimal or maximal value is derived.
PropertyColumn.formulastringClient and server scriptsFormula used in the search column as a string.
PropertyColumn.functionstringClient and server scriptsSpecial function used in the search column.
PropertyColumn.joinstring (read-only)Client and server scriptsJoin ID for the search column.
PropertyColumn.labelstringClient and server scriptsLabel used for the search column, allowing customization.
PropertyColumn.namestring (read-only)Client and server scriptsInternal name of the search column.
PropertyColumn.summarystring (read-only)Client and server scriptsSummary type for the search column.

Practical Usage Example

Here's a sample script snippet demonstrating how to create a search using a column with a formula:

suitescript
1// Add additional code
2...
3search.create({
4 type: search.Type.TRANSACTION,
5 columns: [
6 'trandate',
7 'amount',
8 'entity',
9 'entity.firstname',
10 'entity.email',
11 search.createColumn({
12 name: 'formulatext',
13 formula: "{lastname}||', '||{firstname}"
14 })
15 ],
16 // Add additional code
17});

This script generates transaction search results featuring a concatenated column of last and first names.

Conclusion

The Column object in SuiteScript 2.1 empowers developers to effectively manage and manipulate search data within NetSuite. Its functionalities enhance search operations, making it easier to customize and retrieve the desired results based on specific criteria.

Source: This article is based on Oracle's official NetSuite documentation.

Key Takeaways

  • The Column object is essential for defining search columns in SuiteScript.
  • It supports various methods and properties to customize search result presentation.
  • Practical usage includes building complex columns with formulas for enriched data displays.

Frequently Asked Questions (4)

How can I create a custom search column using a formula in SuiteScript 2.1?
You can create a custom search column with a formula using the `search.createColumn` method. Specify the formula as a string in the `formula` property of the `Column` object to manipulate the data displayed in the search results.
What types of scripts support the Column object in SuiteScript 2.1?
The `Column` object can be used in both client and server scripts within SuiteScript 2.1.
Can I modify the internal name of a Column object in a NetSuite search?
No, the internal name of a search column is a read-only property and cannot be modified. It's defined by the `Column.name` property.
Is it possible to determine which column provides the minimal or maximal value using Column object methods?
Yes, you can use the `Column.setWhenOrderedBy()` method to specify the column from which the minimal or maximal value is derived in your search results.
Source: Column Object Members Oracle NetSuite Help Center. This article was generated from official Oracle documentation and enriched with additional context and best practices.

Was this article helpful?

More in Searches

View all Searches articles →