[SalesForce] Lightning currency input component that respects the records IsoCode

I was so used to Visualforce fields that display a currency value in the CurrencyIsoCode of the relevant record that it took me a while to understand why in Lightning wrong Iso Codes (those of the browser) are used.

  1. What is the recommended way to make Lightning currency fields behave like in the old times?
  2. Who cares abou the browsers currency if the value already has a database-stored semantic?
  3. Does force:inputField respect the CurrencyIsoCode and how can I make it work for generic (dynamic field name binding) usage?
  4. Which other Lightning component of the force:, lightning:, ui:, namepace can and should be used with currencies and when?

Best Answer

Although still in Beta, it looks like the prefered component for currencies is (or will be):

lightning:formattedNumber

which supports currency codes via the currencyCode attribute.

component.cmp:

<lightning:formattedNumber value="5000" style="currency" currencyCode="USD" />

You still need to fetch the currency code from the record though. Or if it is related to a user(s) preference, you can use $Locale, ex:

{!$Locale.currencyCode}

others that can be used (however, dont support the attributes that facilitate formatting and ISO currencies):