ICurrencyCache
The ICurrencyCache service provides cached access to the org's transactioncurrency set plus the organization's base currency. Currencies are loaded as a single snapshot on first access and refreshed on a coarse sliding window — admins rarely add new currencies, so the cache trades a tiny memory footprint for eliminating per-record currency lookups on the hot record-retrieve path.
Automatic Population on Records
You usually don't need to touch ICurrencyCache directly. Whenever a record's fetch includes at least one money column, the server auto-projects transactioncurrencyid and attaches the resolved currency to the record's Currency property. MoneyEdit consumes that to render the correct symbol in its start adornment.
// `record.currency` is populated automatically on every record the typed
// client returns, sourced from the server's currency cache.
const { ppp } = usePowerPortalsPro();
const account = await ppp.retrieveRecordAsync('account', id);
const symbol = account.currency?.symbol; // e.g. "$"
const isoCode = account.currency?.isoCode; // e.g. "USD"
const name = account.currency?.name; // e.g. "US Dollar"// On any record fetched through IPowerPortalsProService:
var account = await _powerPortalsProService.RetrieveRecordAsync("account", id);
var symbol = account.Currency?.Symbol; // e.g. "$"
var isoCode = account.Currency?.IsoCode; // e.g. "USD"
var name = account.Currency?.Name; // e.g. "US Dollar"Direct Access
For custom server-side code that needs to look up a currency by id, enumerate every currency in the org (a currency picker, an exchange-rate display), or resolve the base currency, inject ICurrencyCache:
[Inject]
private ICurrencyCache _currencyCache { get; set; } = null!;
protected override async Task OnInitializedAsync()
{
// Lookup by id (e.g. from a record's transactioncurrencyid)
var currency = await _currencyCache.GetAsync(transactionCurrencyId);
// Enumerate every currency configured in the org
var allCurrencies = await _currencyCache.GetAllAsync();
// Resolve the org's base currency (organization.basecurrencyid)
var baseCurrency = await _currencyCache.GetBaseCurrencyAsync();
}
Tip
ICurrencyCacheis server-side only. Browser-side code that needs the row's currency readsTableRecord.Currency(Blazor) /record.currency(React) directly — populated automatically when the record carries a money column.
ICurrencyCache Interface
Methods
Name | Parameters | Type | Description |
|---|---|---|---|
Get | Guid id | Currency? | Returns the currency with the given |
GetAll | IReadOnlyDictionary<Guid, Currency> | Returns every currency configured in the org, keyed by id. Loaded as a single snapshot — callers iterating the dictionary won't see partial updates if the cache refreshes mid-enumeration. | |
GetAllAsync | CancellationToken token | Task<IReadOnlyDictionary<Guid, Currency>> | Asynchronously returns every currency configured in the org, keyed by id. |
GetAsync | Guid id CancellationToken token | Task<Currency> | Asynchronously returns the currency with the given |
GetBaseCurrency | Currency? | The org's base currency, resolved from | |
GetBaseCurrencyAsync | CancellationToken token | Task<Currency> | Asynchronously returns the org's base currency. |
GetGetAllGetAllAsyncGetAsyncCancellationToken token
GetBaseCurrencyGetBaseCurrencyAsyncCurrency Class
Properties
Name | Type | Default | Description |
|---|---|---|---|
ExchangeRate | decimal | 1 | Exchange rate against the org's base currency, from |
IsoCode | string | The ISO 4217 three-letter code (e.g. | |
Name | string | The localized currency name from | |
Precision | int | 2 | Decimal places to display, sourced from MoneyMetadata.Precision, which is the column-level precision; this is the currency-level default. |
Symbol | string | The display symbol Dataverse stores in |
ExchangeRateIsoCodeNamePrecisionMoneyMetadata.Precision, which is the column-level precision; this is the currency-level default.Symbol