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. Use the AccountingCurrenciesExchangeRate (Manage Accounting Exchange Rates) custom permission to grant permissions on this method.

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. Use the AccountingCurrenciesExchangeRate (Manage Accounting Exchange Rates) custom permission to grant permissions on this method.

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. Use the AccountingCurrenciesExchangeRate (Manage Accounting Exchange Rates) custom permission to grant permissions on this method.

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. Use the AccountingCurrenciesExchangeRate (Manage Accounting Exchange Rates) custom permission to grant permissions on this method.

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–2022 FinancialForce.com, inc. All rights reserved. Various trademarks held by their respective owners.