Question on currency conversion
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2020 04:22 AM
I am getting what i wanted to achieve but wants to clear my concept how its working.
I wanted to convert amount of any currency into euro and created variables and mapped to INC currency field type as shown below.
BR written-
current.u_amount_in_integer = current.u_amount;
gs.log("Test123 " + current.u_amount);
Log- Test123 81647 (euro)
I am getting OOB value in euro only for USD , INR all currency, How its coming can someone explain me.
Is it coming from fx_rate table automatically?
Is this enough to achieve my requirement or do i need to do more coding/query on fx_rate table?
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2020 04:57 AM
Hi,
Currency values can be converted to other currencies when stored and accessed.
- The currency value is converted to reference currency when stored, whether on insert or update. This means that the reference currency value is saved as well as the currency value.
- The currency value is converted to the user’s session currency for display.
- The value entered for a filter from currency specified in the filter is converted to the reference currency.
Conversion rates are stored in the fx_rate table. Each record contains the conversion rate from a given currency to the Euro. The rates are updated daily from the ECB website by a scheduled job called ECB Exchange Rate Load.
- Rate to convert from the first currency to Euro
- Rate to convert from Euro to the second currency
- Different currency values can have different rates applied to them while storing the reference currency value. Aggregation therefore can combine values at different rates and convert back at another rate.
- A filter value is converted at current rates while the values it filters in the database can be converted at different rates. A filter for $100 at today's rate can match a value of $99 obtained at yesterday’s rates.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2020 05:21 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2020 05:31 AM
Hi,
I have already checked those all docs available.
I know Conversion rates are stored in the fx_rate table. Each record contains the conversion rate from a given currency to the Euro
I am not using reference currency which is by default USD. I am not calling fx_rate table or taking reference currency from fx_price
It is just a field with type currency.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2022 02:43 AM
DevTools is a scoped application with many helpful scripts ready to be re-used.
The built-in currency conversion API object (GlideCurrencyConverter) is a bit tricky to use.
Here you can find a nice wrapper function for currency conversion based on the ServiceNow OOTB functionality: