The N/currency module provides access to currency exchange rates configured in your NetSuite account. Use it to convert amounts between currencies in scripts that handle multi-currency transactions.
Getting an Exchange Rate
define(["N/currency", "N/log"], (currency, log) => {
const rate = currency.exchangeRate({
source: "USD",
target: "EUR",
date: new Date()
});
log.debug("USD to EUR rate", rate);
const eurAmount = 1000 * rate;
log.debug("1000 USD in EUR", eurAmount);
return {};
});
Key Method
| Method | Description |
|---|---|
currency.exchangeRate(options) | Returns the exchange rate from source to target currency on a given date |
The exchange rates returned are based on the currency exchange rates you have configured in NetSuite at Lists > Accounting > Currencies > Exchange Rates. Make sure your rates are up to date for accurate conversions.