I need to write some apex code when advanced currency management going to enable in our company. Because salesforce supports only for a limited objects that supporting dated currency rates.Previously I get currency rate from 'CurrencyType' table. Now I'm going to get currency rate from 'DatedConversionRate' table. My question is how I identify if the Advanced currency management is enabled in apex class because I need to dynamically check what table I need refer in order to get currency rate?
Assuming you're doing this in a managed package, you'll need to detect the object at runtime, such as Schema.getGlobalDescribe().containsKey('DatedConversionRate'). Your queries, etc would also all have to be dynamic, otherwise you'll end up with a dependency for dated exchange rates in your package (i.e. it won't install without the feature). You'll need to lean heavily on the describe calls available in Apex Code to make this happen.