0

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?

1
  • I think you'd have to get the dated exchange rate and do the conversion manually.
    – Adrian Larson
    Commented Feb 4, 2020 at 19:06

1 Answer 1

2

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

  • Is it the quote's Opportunity's CloseDate?
  • Is it today's date?
  • Is it some date on the Quote object?

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 ...

  • If the running user always will have local currency = USD

Then you can do SOQL

SELECT ... ConvertCurrency(UnitPrice), ... FROM QuoteLineItem

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .