This post is a part of the daily blog series
A Tip A Day, daily dosage of learning!
Day #19 – Set Currency of User
I have a user whose current Currency is set as SGD – Singapore Dollar
Requirement
The requirement is now to change the Currency of the user to USD. Simple? I thought so too. I just changed the Currency pick list value in User record to USD as shown below.
Easy, done, I thought until I wrote a SOQL query to check the currency using Developer Console. It still shows SGD. I refreshed, tried everything but it shows the same, SGD!
Solution
After lots of research I found out that there are 2 currency fields in User object! Wow. I didn’t know that. They are DefaultCurrencyIsoCode and CurreencyIsoCode.
- The first one (DEFAULTCURRENCYISOCODE) is the user’s Currency field in the Locale Settings section.
- The second one (CURRENCYISOCODE) is NOT available via the User Interface and can be accessed only via API.
So, what we have in the UI in the record is DefaultCurrencyIsoCode (in my case changed to USD). But I’m querying CurrencyIsoCode (which was still SGD). That’s the issue!
I changed the DefaultCurrencyIsoCode directly in the Developer Console. Then everything was fine!
@SFDCFANBOY – Very nice and informative article. I wonder which among these 2 currency fields does the conversion ? I mean I have a Currency value in Account, if I login as the User with DefaultCurrency USD and CurrencyISO as SGD, what I should see ?
Thanks,
SM
LikeLiked by 1 person
You’d see USD (DefaultCurrency) in the UI.
LikeLike