currency type filed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2025 01:53 AM
Hey, I have currency type filed on project table.
when I get the value in business rule the value automatically converted to other currency.
its weird because I get the currency using
and the currency is correct but the value is not.
why its doing that and how to fix ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2025 01:58 AM
I think System-stored values are always in the base currency—don’t rely on getValue()
alone.
below can be use to get the formatted value in the correct currency rather than the system-stored conversion.
current.u_additional_external_costs.getDisplayValue();
gs.info("Currency Value: " + currencyValue);
Thanks,
Tushar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2025 02:05 AM
Hey, this is the gs.info that I use in the business rule
gs.info('eyal test project' + current.getDisplayValue('u_additional_external_costs') +' and the currncy is = '+ current.u_additional_external_costs.getCurrencyCode() + ' regualr value is ' + current.u_additional_external_costs);
everything is returning the converted number
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2025 02:17 AM
Hi @eyal abu hamad -
GlideCurrencyConverter.getAmountInCurrency(gr, 'field', 'currency_code')
This retrieves the amount in the actual currency instead of the automatically converted system base currency.
var gr = new GlideRecord('project'); // your table
if (gr.get(current.sys_id)) {
var currencyField = 'u_additional_external_costs';
var targetCurrency = gr.getValue('currency'); // get record's currency
//get actual amount in the stored currency
var convertedAmount = GlideCurrencyConverter.getAmountInCurrency(gr, currencyField, targetCurrency);
gs.info('Eyal Test Project: Display Value = ' + gr.getDisplayValue(currencyField) +
', Currency = ' + gr.getCurrencyCode(currencyField) +
', Corrected Amount = ' + convertedAmount);
}
If you found my response helpful, I would greatly appreciate it if you could mark it as "Accepted Solution" and "Helpful." Your support not only benefits the community but also encourages me to continue assisting. Thank you so much!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2025 02:04 AM
Hi @eyal abu hamad
If you want to retrieve the exact value stored in the database without conversion, use the getDisplayValue() method, which gives the raw amount in the stored currency.
current.u_additional_external_costs.getCurrencyCode();
If you found my response helpful, I would greatly appreciate it if you could mark it as "Accepted Solution" and "Helpful."
Your support not only benefits the community but also encourages me to continue assisting. Thank you so much!
Thanks and Regards
Ravi Gaurav | ServiceNow MVP 2025,2024 | ServiceNow Practice Lead | Solution Architect
CGI
M.Tech in Data Science & AI
YouTube: https://www.youtube.com/@learnservicenowwithravi
LinkedIn: https://www.linkedin.com/in/ravi-gaurav-a67542aa/