This post is a part of the daily blog series
Day #19 – Set Currency of User
I have a user whose current Currency is set as SGD – Singapore Dollar
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!
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!