Historically it's been possible to determine if advanced currency management is enabled by using:
Schema.getGlobalDescribe().containsKey('DatedConversionRate');
as this object is only available on orgs with this feature enabled.
See How to identify Advanced currency is enabled in apex class?
Also, per the docs:
This object is for multicurrency organizations with advanced currency management enabled. Use this object to define the exchange rates your organization uses for a date range. This object is not available in single-currency organizations, nor is it available if the organization does not have advanced currency management enabled.
On two orgs today I found that the DatedConversionRate object is showing up even if advanced currency management is disabled (I don't know if this only happens on orgs where advanced currency management has previously been enabled).
What I'd like to know is:
- Does anyone else reproduce this issue?
- Can anyone test this on a multi currency org that has never had advanced currency management enabled?
- Does anyone know of an alternate way to determine in Apex if advanced currency management is enabled?
- Am I missing anything obvious here?
Here's a test class you can use to detect the presence of DatedConversionRate objects. I have tested on APIs back to 32, so it does not seem to be a versioned change.
@istest
public class test1 {
@istest
public static void test1()
{
Map<String, Schema.SObjectType> gd = Schema.getGlobalDescribe();
system.debug(gd.containsKey('DatedConversionRate'));
}
}
Select Id from DatedConversionRate
. No rows come back, but it appears to be a valid SOQL query,DatedConversionRate
returned no records, would it be equivalent to the feature being disabled? Not as efficient as the describe call. Maybe as a backup option?