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?

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

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
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.