Accounting Apex API Developer Reference

c2g.ExchangeRateService

global without sharing class ExchangeRateService

The service class relating to the management of Exchange Rates.

Methods

upsertExchangeRatesOrgWide

global static void upsertExchangeRatesOrgWide(List<c2g.ExchangeRateService.OrgWideExchangeRate> exchangeRateList)

This service enables you to insert and update exchange rates for companies that manage them at org-wide level.

Input Parameters

Name Type Description
exchangeRateList List<c2g.ExchangeRateService.OrgWideExchangeRate> This service takes an exchange rate list List<c2g.ExchangeRateService.OrgWideExchangeRate> exchangeRateList as an input parameter.

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

List<c2g.ExchangeRateService.OrgWideExchangeRate> rateList = new List<c2g.ExchangeRateService.OrgWideExchangeRate>();
ExchangeRateService.OrgWideExchangeRate rate = new ExchangeRateService.OrgWideExchangeRate();
rate.CurrencyISOCode = 'EUR';
rate.BaseCurrencyISOCode = 'AUD';
rate.Rate = 6.39;
rate.EffectiveDate = date.newinstance(2015, 11, 30);
rateList.add(rate);
ExchangeRateService.upsertExchangeRatesOrgWide(rateList);

deleteExchangeRatesOrgWide

global static void deleteExchangeRatesOrgWide(List<c2g.ExchangeRateService.OrgWideExchangeRate> exchangeRateList)

This service deletes org-wide exchange rates.

Input Parameters

Name Type Description
exchangeRateList List<c2g.ExchangeRateService.OrgWideExchangeRate> This service takes an exchange rate list List<c2g.ExchangeRateService.OrgWideExchangeRate> exchangeRateList as an input parameter.

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

List<ExchangeRateService.OrgWideExchangeRate> rateList = new List<ExchangeRateService.OrgWideExchangeRate>();
ExchangeRateService.OrgWideExchangeRate rate = new ExchangeRateService.OrgWideExchangeRate();
rate.CurrencyISOCode = 'GBP';
rate.BaseCurrencyISOCode = 'EUR';
rate.EffectiveDate = date.newinstance(2015, 11, 20);
rateList.add(rate);
ExchangeRateService.deleteExchangeRatesOrgWide(rateList);

upsertExchangeRatesCompanySpecific

global static void upsertExchangeRatesCompanySpecific(List<c2g.ExchangeRateService.CompanySpecificExchangeRate> exchangeRateList)

This service enables you to insert and update exchange rates for companies that manage their own rates.

Input Parameters

Name Type Description
exchangeRateList List<c2g.ExchangeRateService.CompanySpecificExchangeRate> This service takes an exchange rate list List<c2g.ExchangeRateService.CompanySpecificExchangeRate> exchangeRateList as an input parameter.

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

Date effectiveDate = date.newinstance(2014, 1, 1);
Id companyId = ‘a1Y28000000DmwS’;
List<c2g.ExchangeRateService.CompanySpecificExchangeRate> rateList = new List<c2g.ExchangeRateService.CompanySpecificExchangeRate>();
ExchangeRateService.CompanySpecificExchangeRate rate = new ExchangeRateService.CompanySpecificExchangeRate();
rate.CompanyId = companyId;
rate.CurrencyISOCode = 'GBP';
rate.BaseCurrencyISOCode = 'EUR';
rate.Rate = 6.39;
rate.EffectiveDate = effectiveDate;
rateList.add(rate);
ExchangeRateService.upsertExchangeRatesCompanySpecific(rateList);

deleteExchangeRatesCompanySpecific

global static void deleteExchangeRatesCompanySpecific(List<c2g.ExchangeRateService.CompanySpecificExchangeRate> exchangeRateList)

This service deletes company-specific exchange rates.

Input Parameters

Name Type Description
exchangeRateList List<c2g.ExchangeRateService.CompanySpecificExchangeRate> This service takes an exchange rate list List<c2g.ExchangeRateService.CompanySpecificExchangeRate> exchangeRateList as an input parameter.

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

List<ExchangeRateService.CompanySpecificExchangeRate> rateList = new List<ExchangeRateService.CompanySpecificExchangeRate>();
ExchangeRateService.CompanySpecificExchangeRate rate = new ExchangeRateService.CompanySpecificExchangeRate();
rate.CompanyId = 'a1i28000000DYZK';
rate.CurrencyISOCode = 'GBP';
rate.EffectiveDate = date.newinstance(2015, 11, 20);
rateList.add(rate);
ExchangeRateService.deleteExchangeRatesCompanySpecific(rateList);

getExchangeRatesOrgWide

global static List<c2g.ExchangeRateService.OrgWideExchangeRate> getExchangeRatesOrgWide(Date effectiveDate)

This service returns org-wide exchange rates for a given date.

Input Parameters

Name Type Description
effectiveDate Date This service takes an Effective Date as an input parameter.

Return Value

This service returns a List<c2g.ExchangeRateService.OrgWideExchangeRate> object.

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

Date effectiveDate = date.newinstance(2014, 1, 1);
ExchangeRateService.getExchangeRatesOrgWide(effectiveDate );

getExchangeRatesCompanySpecific

global static List<c2g.ExchangeRateService.CompanySpecificExchangeRate> getExchangeRatesCompanySpecific(Date effectiveDate, Id companyId)

This service returns company-specific exchange rates for a given date and company.

Input Parameters

Name Type Description
effectiveDate Date This service takes an Effective Date as an input parameter.
companyId Id This service takes a company Id as an input parameter.

Return Value

This service returns a List<c2g.ExchangeRateService.CompanySpecificExchangeRate> object.

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

Date effectiveDate = date.newinstance(2014, 1, 1);
Id companyId = ‘a1Y28000000DmwS’;
ExchangeRateService.getExchangeRatesCompanySpecific(effectiveDate,companyId );

c2g.ExchangeRateService.ExchangeRate

global abstract class ExchangeRate

Properties

Name Type Description
CurrencyISOCode String The related accounting currency.
Rate Decimal Exchange rate for this currency relative to base currency. The default is 1.000000000. This rate is dynamic, but existing transactions will continue to reflect the exchange rate in force at the time of posting.
EffectiveDate Date First day the rate is to be applied.

c2g.ExchangeRateService.OrgWideExchangeRate

global class OrgWideExchangeRate extends ExchangeRate

Holds the structure of an org-wide exchange rate.

This class extends c2g.ExchangeRateService.ExchangeRate

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

ExchangeRateService.OrgWideExchangeRate rate = new ExchangeRateService.OrgWideExchangeRate();
rate.CurrencyISOCode = 'EUR';
rate.BaseCurrencyISOCode = 'AUD';
rate.Rate = 6.39;
rate.EffectiveDate = date.newinstance(2015, 11, 30);

Properties

Name Type Description
BaseCurrencyISOCode String The base accounting currency.

c2g.ExchangeRateService.CompanySpecificExchangeRate

global class CompanySpecificExchangeRate extends ExchangeRate

Holds the structure of a company-specific exchange rate.

This class extends c2g.ExchangeRateService.ExchangeRate

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

ExchangeRateService.CompanySpecificExchangeRate rate = new ExchangeRateService.CompanySpecificExchangeRate();
rate.CompanyId = 'a1i28000000DYZK';
rate.CurrencyISOCode = 'GBP';
rate.Rate = 3.45;
rate.EffectiveDate = date.newinstance(2015, 11, 20);

Properties

Name Type Description
CompanyId Id The related FinancialForce company for this rate, where applicable.
© Copyright 2009–2019 FinancialForce.com, inc. Confidential – all rights reserved. Various trademarks held by their respective owners.