Currency Object Members in SuiteScript 2.1 Reference

The Currency object in SuiteScript 2.1 provides essential members for managing currency amounts and IDs in NetSuite.

·2 min read·View Oracle Docs

The Currency object in SuiteScript 2.1 allows developers to effectively manage currency data through its members. Each member plays a critical role in defining currency attributes, such as the amount and ID, for use in complex calculations and applications within NetSuite workflows.

What Are the Members of the Currency Object?

The following members are part of the workbook.Currency object:

Member NameTypeDescriptionSupported Script Types
Currency.amountnumberRepresents the amount of the currency.Server scripts
Currency.idstringDefines the currency ID (e.g., USD, EUR).Server scripts

Detailed Descriptions

  • Currency.amount: This property returns the numeric value of the currency amount. It is important to note that this property is read-only after the workbook.Currency object is created. Attempting to modify it will result in an error (READ_ONLY_PROPERTY).
  • Currency.id: This property provides the identifier for the currency in use, facilitating currency-based transactions and queries.

How to Create a Currency Object

Developers can instantiate a Currency object using the method workbook.createCurrency(options). This method allows for the setting of initial amounts and IDs, streamlining the process of currency management in various scripting scenarios.

Error Handling

When working with the Currency object, it's crucial to handle potential errors effectively. For instance, trying to set the Currency.amount after the object creation will lead to a READ_ONLY_PROPERTY error. It’s advised to manage object values immediately upon creation to avoid this issue.

Who This Affects

This content is especially relevant for:

  • Developers: Who utilize SuiteScript for custom NetSuite solutions.
  • Administrators: Who manage financial and currency configurations within NetSuite.

Key Takeaways

  • The Currency object is essential for handling currency data in SuiteScript.
  • It includes critical members such as amount and id for comprehensive currency management.
  • Developers must recognize property access restrictions post-creation to avoid runtime errors.

Frequently Asked Questions (4)

Is the Currency.amount property modifiable after the Currency object is created?
No, the Currency.amount property is read-only after the Currency object is created. Attempting to modify it will result in a READ_ONLY_PROPERTY error.
What script types support the members of the Currency object?
The members of the Currency object, such as Currency.amount and Currency.id, are supported in server scripts.
How can developers create a Currency object in SuiteScript 2.1?
Developers can instantiate a Currency object using the workbook.createCurrency(options) method, which allows for setting the initial currency amount and ID.
What error might occur if attempting to modify Currency.amount after creation?
Attempting to modify Currency.amount after the object has been created will cause a READ_ONLY_PROPERTY error.
Source: Currency 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 Currency

View all Currency articles →