Reputation: 35
I have a custom record in netsuite with several fields. One field is transaction date, another is Amount (number) and the third one is currency (USD, CAD, etc). I would like to calculate in another column the USD equivalent of the amount field based on the currency. For example 1/1/2016 CAD $1000 and from those three fields in the custom record, I would like to put the value in a fourth field that would convert the $1000 CAD to USD using the exchange rate for 1/1/2016. I have found the following API in NetSuite -- "nlapiExchangeRate(sourceCurrency, targetCurrency, effectiveDate) " but I cannot get it to work. Any ideas if this is possible? Thanks.
Upvotes: 2
Views: 930
Reputation: 2840
Suitescript API are not allowed in Saved Searches or Custom Formula Fields.
Upvotes: 1
Reputation: 2250
I just tested this with the same example on the SuiteAnswers site (below) It worked fine for me. Make sure you are getting your values and trying to run the data after you are sure you ave everything.
var usdAmt=100.00;
var rate=nlapiExchangeRate('USD','CAD','01/01/2016');
var canAmt=usdAmt*rate;
nlapiLogExecution('DEBUG',rate+' / '+canAmt);
The link to that page, in case you don't have it, is:
nlapiExchangeRate(sourceCurrency, targetCurrency, effectiveDate)
Upvotes: 1