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.
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 Name | Type | Description | Supported Script Types |
|---|---|---|---|
Currency.amount | number | Represents the amount of the currency. | Server scripts |
Currency.id | string | Defines 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 theworkbook.Currencyobject 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
Currencyobject is essential for handling currency data in SuiteScript. - It includes critical members such as
amountandidfor 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?
What script types support the members of the Currency object?
How can developers create a Currency object in SuiteScript 2.1?
What error might occur if attempting to modify Currency.amount after creation?
Was this article helpful?
More in Currency
- Automated Currency Exchange Rates in NetSuite 2026.1
Automated Currency Exchange Rates introduced in NetSuite 2026.1 simplify currency conversion and reporting, improving accuracy and efficiency.
- N/currency Module for Multi-Currency Management in NetSuite
The N/currency module manages exchange rates in NetSuite, enabling transactions in multiple currencies with accurate rates.
Advertising
Reach Currency Professionals
Put your product in front of NetSuite experts who work with Currency every day.
Sponsor This Category