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
Syed Moin PashaSyed Moin Pasha 

unable to fetch currencyTypes in apex class in the MultiCurrency Disabled org

Hi,

I am beginner in lightning
unable to fetch  currencyTypes in apex class in the MultiCurrency Disabled org

Here is my Code 

@AuraEnabled
    public static List<selectOptions> getCurrencies(){
        List<selectOptions> options = new List<selectOptions>();
        boolean IsmultiCurrencyEnabled = Schema.getGlobalDescribe().containsKey('CurrencyType');
        if(IsmultiCurrencyEnabled){
            List <CurrencyType> currencies = Database.Query('SELECT IsoCode FROM CurrencyType');
            for(CurrencyType a : currencies){
                options.add(new SelectOptions(a.IsoCode,a.IsoCode));
            }
        }
        return options;
    }

Error : Invalid type: CurrencyType

Please help me out with this 
Khan AnasKhan Anas (Salesforce Developers) 
Hi Moin,

Greetings to you!

This object is for multicurrency organizations only. CurrencyType represents the currencies used by an organization for which the multicurrency feature is enabled

https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_currencytype.htm

I hope it helps you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.

Thanks and Regards,
Khan Anas