- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-04-2014 09:03 AM
I'm developing an invoice tracker for an international department and am running into an issue with localization.
A department needs to see the correct currency for each invoice. But if a locale is set properly for each user, it converts the shown amount into their local currency. With no locale, it defaults to system (US dollars).
Is there a way to fix a currency field to always show the original currency selected to all users? No dictionary attribute seems to be specific to the currency field
Current behavior
(UK user)
Invoice 1 £3521.17
Invoice 2 £3,500.00
Invoice 3 £8763.22
(US user)
Invoice 1 $5,000.00
Invoice 2 $4,739.11
Invoice 3 $9,219.83
Desired behavior:
(All users)
Invoice 1 $5,000.00
Invoice 2 £3,500.00
Invoice 3 CHF 10,000.00
Am I just going to have to bite the bullet and recreate these fields as decimals with a separate field for currency? That would be heinous.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-12-2014 07:18 AM
I replied to another thread by Michel Conter -- he got pointed to a solution that SN disavows support of (since it's a customization, I'd guess).
The wiki does have an article or two about using Fixed Currency, but since it was in relation to catalog items I moved on and couldn't find anything more specific. I should have paid closer attention.
If you do set a field as Price type, an "Edit" link appears next to it when it's displayed on the form, which when clicked sends you to the matching record in the fx_price table. That record has a type field that you can change it from Multiple Currencies to Fixed. Once it's set to Fixed, it stays there.
You can create an after insert/update business rule that watches for changes to your price field that you want to keep in their original currencies, and have them update their matching record in fx_price to set the type to "fixed".
Since I had many such fields, I created a script include to handle this:
function setPriceAsFixed(grID, fld) {
var p = new GlideRecord("fx_price");
p.addQuery("id", grID);
p.addQuery("field", fld);
p.addQuery("type", "!=", "fixed");
p.query();
if (p.next()) {
p.type = "fixed";
p.update();
}
}
My version of that takes fld as an array and uses p.addQuery("field", "IN", fldArr) instead of that listed addQuery line (along with using a while(p.next())) , since some of my invoicing tables have multiple price fields per record.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-04-2014 09:19 AM
The "price" type also does this.
On lists it looks like you can toggle what value is shown, but if the form is read only it forces the user's locale.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-02-2017 08:07 AM
Thank you. I don't know if I skipped this on the doc/wiki site, but I couldn't find this information. You have no idea how much pain you saved me.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-04-2014 09:58 AM
Look at this on the service-now wiki?
http://wiki.servicenow.com/index.php?title=Scripting_Currency_and_Price_Fields
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-04-2014 10:16 AM
I understand how to pull out values for scripting. I'm talking about what the end users see on the forms. If they have a set locale, it shows all values in their local currency.