function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Kenneth WangKenneth Wang 

How to disable convertCurrency for currency field when using List View Results rest API?

My Org has several active currencies, the corporate currency is USD. When I using the following List View Results API to get the records,
/vXX.X/sobjects/{sobjectType}/listviews/{listViewID}/results
the currency type field value is automatically converted to USD.

For example:
On object's list view page, the currency field value is
CNY 500.50 (USD 83.42)
but in the result of rest API, its value is
...  
    {
        "ascendingLabel":"9-0",
        "descendingLabel":"0-9",
        "fieldNameOrPath":"My_Cost__c",
        "hidden":false,
        "label":"My Cost",
        "searchable":false,
        "selectListItem":"convertCurrency(My_Cost__c)",
        "sortDirection":null,
        "sortIndex":null,
        "sortable":true,
        "type":"currency"
    },
...
    {
        "fieldNameOrPath":"My_Cost__c",
        "value":"83.42"
    },
    {
        "fieldNameOrPath":"CurrencyIsoCode",
        "value":"CNY"
    },
...

Is that possible to disable the convertCurrency when using List View Results rest API? I want to get the original value.
...    
    {
        "fieldNameOrPath":"My_Cost__c",
        "value":"500.50"
    },
...

 
GauravGargGauravGarg

Hi Kenneth, 

Apologies, once the Multi-currency is enabled you cannot disable it. But you can use Default Currency Field for your requirement. Salesforce always keep 3 fields for currency:
1. Default Currency
2. Locale Currency i.e. currency based on logged in user
3. Converted Currency. 

Thanks, 

Gaurav Garg
Salesforce Consultant
Skype: gaurav62990

Kenneth WangKenneth Wang
Thanks Gaurav.

Further question, how do I get the default currency of the current user via rest API?
GauravGargGauravGarg

Hi Kenneth, 

I checked online but didn't found any resourceful document from Salesforce which identify this root cause. As I already saw, you already put "ConvertedCurrency(My_Cost__c)", the converted currency field will auto-convert all the currency field in the Org into Corporate currency selected. 

Will still check on this and update you. 


Thanks,

Gaurav Garg

Kenneth WangKenneth Wang
The "ConvertedCurrency(My_Cost__c)" is added by List View Results rest API automatically, it looks like we cannot change it.

I tried change my default currency via Settings -> My Personal Information -> Language & Time Zone.
When currency is USD:
... { "columns": [ ... { "fieldNameOrPath":"My_Cost__c", "value":"83.42" }, { "fieldNameOrPath":"CurrencyIsoCode", "value":"CNY" }, ... ] } ...
When currency is CNY:
... { "columns": [ ... { "fieldNameOrPath":"My_Cost__c", "value":"500.50" }, { "fieldNameOrPath":"CurrencyIsoCode", "value":"CNY" }, ... ] } ...
When currency is EUR:
... { "columns": [ ... { "fieldNameOrPath":"My_Cost__c", "value":"67.31" }, { "fieldNameOrPath":"CurrencyIsoCode", "value":"CNY" }, ... ] } ...

CurrencyIsoCode is always "CNY", which is the original currency I entered when I created the record. Not sure it is a bug or something else.
GauravGargGauravGarg
Hi Kenneth,

This isn't a bug. the CurrencyIsoCode is based on Record currency. When you created a record in China province with CNY currency. The record is seems to be CNY currency. 

If you create a record with CurrencyIsoCode as "USD", it will give USD values.