Apex Features

Because some users may query the database directly using our Apex interface, Omnata has provided access to our multi-currency handling classes for Apex users.

These take the form of global classes that can be invoked from code outside of the managed package.

Data Classes

The following classes are used to carry currency-rated data. They are used in place of the standard sObjects (CurrencyType, DatedConversionRate) since these objects may or may not exist depending on the Org configuration.

omnata_sf.ConversionRate

omnata_sf.ConversionRateAtDate

Helper Classes

omnata_sf.CurrencyHelper

Contains logic for handling various multi-currency scenarios.

getDatedExchangeRate(String currencyCode, Date effectiveDate)

Returns a omnata_sf.ConversionRate object, containing the conversion information for the provided currency code, at the provided effective date.

This information will come from the DatedConversionRate Salesforce object.

Example usage (assumes existing multi-currency configuration in Salesforce):

omnata_sf.ConversionRate rate = omnata_sf.CurrencyHelper.getDatedExchangeRate('USD', Date.valueOf('2021-08-01');
System.assertEquals(Decimal.valueOf('0.70'),rate.conversionRate));

getExchangeRate(String currencyCode)

Returns a omnata_sf.ConversionRateAtDate object, containing the conversion information for the provided currency code

This information will come from the CurrencyTypeSalesforce object.

Last updated