ExtensionInfo Class

Contains static methods to expose extension-related context information.

Namespace

CommerceExtension

Example

1// The Sample Extension Provider registered with developer name as 
2        // 'tax_extension_provider_for_us' will be selected for execution for en_US locale
3        if(CommerceExtension.ExtensionInfo.getLocaleString() == 'en_US') {
4            return new CommerceExtension.Resolution('tax_extension_provider_for_us');
5        }
6        // The Sample Extension Provider registered with developer name as 
7        // 'tax_extension_provider_for_canada' will be selected for execution for en_CA locale
8        if(CommerceExtension.ExtensionInfo.getLocaleString() == 'en_CA') {
9            return new CommerceExtension.Resolution('tax_extension_provider_for_canada');
10        }
11        // The default Salesforce Internal Tax Api will return an empty response for German locale
12        if(CommerceExtension.ExtensionInfo.getLocaleString() == 'de') {
13            return new CommerceExtension.Resolution(CommerceExtension.ResolutionStates.OFF);
14        }

ExtensionInfo Methods

The following are methods for ExtensionInfo.

getClientApiVersion()

Returns the version number of the Client API for the extension context.

Signature

public static Double getClientApiVersion()

Return Value

Type: Double

Version number of the Client API for the extension context.

getCustomParameterField(fieldName)

Returns a custom parameter field value, if available, for the extension context.

Signature

public static String getCustomParameterField(String fieldName)

Parameters

fieldName
Type: String
Custom parameter field name.

Return Value

Type: String

Custom parameter field value for the extension context.

getLocaleString()

Returns the locale for the extension context.

Signature

public static String getLocaleString()

Return Value

Type: String

Locale for the extension context.

isCustomParametersAvailable()

Indicates whether custom parameters are available for the extension context.

Signature

public static Boolean isCustomParametersAvailable()

Return Value

Type: Boolean

Value indicating if custom parameters are available in the extension context (true) or not (false).