I have to do a VF with a "total" field for Quotes in a multi-currency org.
Is there a way for me to obtain the QuoteLineItem.UnitPrice
in U$D regardless of the user's currency configuration?
I have to do a VF with a "total" field for Quotes in a multi-currency org.
Is there a way for me to obtain the QuoteLineItem.UnitPrice
in U$D regardless of the user's currency configuration?
If using Advanced Currency Management
, the dated exchange rates don't apply to objects other than those related to Opportunities
Dated exchange rates are used for opportunities, opportunity products, opportunity product schedules, campaign opportunity fields, opportunity splits, and reports related to these objects and fields. Dated exchange rates are not used in forecasting, currency fields in other objects, or currency fields in other types of reports.
In this use case, what I've done in the past is define a shadow Number
field on the Quote
and QuoteLineItem
called Amount_USD__c
and compute it manually using a beforeInsert/update trigger by fetching values from the DatedConversionRate
object. See this answer for an example implementation. You need to decide what "date" to use as the filter
You want the shadow field to be a Number
, not a Currency
If using a non-advanced currency management implementation where currency rates are fixed (essentially, they are the current exchange rates), then ...
Then you can do SOQL
SELECT ... ConvertCurrency(UnitPrice), ... FROM QuoteLineItem