format.getCurrencyFormatter(options)

Method Description

Creates a format.CurrencyFormatter object to format numbers into currency strings.

Returns

Object

Supported Script Types

Client and server scripts

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

Governance

10 units

Module

N/format/i18n Module

Methods and Properties

N/format/i18n Module Members

Since

2019.2

Parameters
Note:

The options parameter is a JavaScript object.

Warning:

These parameters are mutually exclusive, you can always use only one of them.

Parameter

Type

Required / Optional

Description

Since

options.currency

string

required if options.locale is not specified

Code of the currency that is used by formatter.

2019.2

options.locale

string

required if options.currency is not specified

Code of the locale that is used by formatter.

2021.1

Syntax

Important:

The following code snippet shows the syntax for this member. It is not a functional example. For a complete script example, see N/format/i18n Module Script Samples.

            // Add additional code
... 
    var curFormatter = format.getCurrencyFormatter({
        currency: "EUR"
    });

     var locale_curFormatter = format.getCurrencyFormatter({
        locale: "IT_IT"
    });
...
// Add additional code 

          

Errors

Error Code

Thrown If

SSS_MISSING_REQD_ARGUMENT

Currency parameter is missing

SSS_INVALID_CURRENCY

The currency is not valid

SSS_INVALID_TYPE_ARG

The parameter type is wrong

NEITHER_ARGUMENT_DEFINED

Both parameters are missing

MUTUALLY_EXCLUSIVE_ARGUMENTS

Multiple mutually exclusive parameters have been set as required or optional

INVALID_LOCALE

The locale is not valid

Related Topics

General Notices