Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Get Converted Amount from GlideCurrencyConverter

Harish74
Tera Expert

Hi,

I'm doing currency conversion using GlideCurrencyConverter. The amount is getting converted,

I'm not sure how to retrieve the converted amount.

var conv = new sn_currency.GlideCurrencyConverter('USD', 'INR');
conv.setAmount(1);
gs.log(conv.convert());

Output: CurrencyExchangeValue{fOriginalAmount=1, fOriginalCurrency='USD', fRate=79.510217, fAmount=79.510217, fCurrency='INR', fRateSysId='5553445f494e525f3230323230383135'}

Please help me to get the converted amount. (i.e, fAmount in the above output)

3 REPLIES 3

Vasantharajan N
Tera Sage
Tera Sage

Please refer to the document below 

https://developer.servicenow.com/print_page.do?release=quebec&category=null&identifier=GlideCurrencyExchangeValueScopedAPI&module=api


Thanks & Regards,
Vasanth

Sudha Rani
Tera Contributor

Hi Harish,

Did you get any answer?

Liam Allport1
Tera Contributor

Ran into this with the same issue, there's an additional API that contains the functions to grab values from the original currency conversion that is not referenced in GlideCurrencyConverterGlideCurrencyExchangeValue - Scoped

 

For your example, you would want to do:

gs.log(conv.convert().getAmount());