search.createSetting(options)

Note:

The content in this help topic pertains to SuiteScript 2.0.

Method Description

Creates a new search setting and returns it as a search.Setting object.

Search settings let you specify search parameters that are typically available only in the UI. The following settings are supported:

  • Consolidated Exchange Rate: This setting affects how consolidation is performed (for example, consolidation using the Average rate type, consolidation using the Historical rate type, and so on). This setting applies to transaction searches, and it is applicable only to OneWorld accounts.

  • Show Period End Transactions: This setting indicates whether period end transactions are included in search results. This setting applies to transaction searches, and it is applicable only to OneWorld accounts. It also requires the Period End Journal Entries feature to be enabled.

After you create your settings, assign them as array values to Search.settings.

Returns

search.Setting

Supported Script Types

Client and server scripts

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

Governance

None

Module

N/search Module

Since

2018.2

Parameters
Note:

The options parameter is a JavaScript object.

Parameter

Type

Required / Optional

Description

Since

options.name

string

Required

The name of the search parameter to set. This value sets the Setting.name property.

Use one of the following values for this parameter:

  • consolidationtype: This value corresponds to the Consolidated Exchange Rate setting.

  • includeperiodendtransactions: This value corresponds to the Show Period End Transactions setting.

2018.2

options.value

string

Required

The value of the search parameter. If you are executing a joined search, this value is the join ID used for the search field specified by the options.name parameter. This value sets the Setting.value property.

If you specify consolidationtype as the search parameter name, use one of the following values for this parameter:

  • ACCTTYPE

  • AVERAGE

  • CURRENT

  • HISTORICAL

  • NONE

The default value is ACCTTYPE, which represents the type of consolidation associated with the account.

If you specify includeperiodendtransactions as the search parameter name, use one of the following values for this parameter:

  • F

  • FALSE

  • T

  • TRUE

The default value is false.

These values are not case sensitive.

2018.2

Errors

Error Code

Thrown If

SSS_INVALID_SRCH_SETTING

An unknown search parameter name is provided.

SSS_INVALID_SRCH_SETTING_VALUE

An unsupported value is set for the provided search parameter name.

SSS_MISSING_REQD_ARGUMENT

A 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 mySearch = search.create({
    type: 'transaction',
    columns: [ 'trandate', 'amount', 'entity' ],
    filters: [
        search.createFilter({
            name: 'internalid',
            operator: search.Operator.ANYOF,
            values: [13, 12356]
        })],
    settings: [
        search.createSetting({
            name: 'consolidationtype',
            value: 'NONE'
        })] 
});
...
//Add additional code 

        

Related Topics

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

General Notices