A Tip A Day #19 – Set Currency of User

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

user_record_sfdcfanboy

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.

user_usd_sfdcfanboy

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!

query_developerconsole_sfdcfanboy

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.

  1. The first one (DEFAULTCURRENCYISOCODE) is the user’s Currency field in the Locale Settings section.
  2. 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!

query_isocode_user_sfdcfanboyI changed the DefaultCurrencyIsoCode directly in the Developer Console.  Then everything was fine!


Read all other tips of the blog series here – A Tip A Day, daily dosage of learning!


Enter your email address to follow this blog and receive notifications of new posts by email.

Advertisements

One Reply to “A Tip A Day #19 – Set Currency of User”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s