Modules

filter

 

Objects/Functions

module (N/currency)

SuiteScript 2.0

currency.exchangeRate(options)

{currency}.exchangeRate({date: {Date},source: {number | string*},target: {number | string*}})

N/currency Module
currency.exchangeRate()
Method Description: Method used to return the exchange rate between two currencies based on a certain date. The source currency is looked up relative to the target currency on the effective date. For example, if use British pounds for the source and US dollars for the target and the method returns '1.52’, this means that if you were to enter an invoice today for a GBP customer in your USD subsidiary, the rate would be 1.52. The exchange rate values are sourced from the Currency Exchange Rate record. The Currency Exchange Rate record itself is not a scriptable record. Only base currencies can be converted. The target must be a base currency in your NetSuite account. If not, inaccurate values are returned. For details, see Setting a Base Currency.
Returns: The exchange rate as a decimal number
Supported Script Types: Client and server-side scripts For additional information, see SuiteScript 2.0 Script Types.
Governance: 10 units
Module: N/currency Module
Since: 2015.2
Search NetSuite - https://system.netsuite.com/app/help/helpcenter.nl?search=currency.exchangeRate(options)

Example:

// Code Example 1
//Add additional code
//...
var canadianAmount = 100;
var rate = currency.exchangeRate({
source: 'CAD',
target: 'USD',
date: new Date('7/28/2015')
});
var usdAmount = canadianAmount * rate;
//...
//Add additional code

//SOURCE: https://system.netsuite.com/app/help/helpcenter.nl?fid=section_4358678787.html