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
Nobu.SNobu.S 

How to get CurrencyIsoCode list in Apex class?

Hello.

I created an Apex Class for csv data importing function. When a data for CurrencyIsoCode was wrong/blank, 'try/catch' like code below doesn't work and salesforce shows a validation error.
*my organization uses multi-currency function
String cur = 'USDD';
PriceBookEntry pbe = new PriceBookEntry();
try{
pbe.CurrencyIsoCode = cur;
} catch(Exxception e){
....
}

To avoid this situation, I'd like to get current CurrencyIsoCode list in the apex class. Is there some way to get such list as Set<String>?
Best Answer chosen by Nobu.S
Nobu.SNobu.S
solution found
Set<String> validCurrency = new Set<String>();
Schema.DescribeFieldResult f = Pricebook2.CurrencyIsoCode.getDescribe();
for (Schema.PicklistEntry pick:f.getPicklistValues()){
          validCurrency.add(pick.getValue());
 }