1

We have enabled multicurrency in our org.

There are some places where in Apex classes and Visualforce pages which is hard coding or returning '$'.

My concern is there is some old code and functionality which no one knows how it works or used.

For example:

public String getGrandTotalRequested() {

double returnVal = 0;

for (Renewal_Quote_Line_Item__c i : LineItemsList.values()) {

returnVal += i.Extended_Price_Requested__c;

}

return '$' + (returnVal.format().contains('.') ? returnVal.format() : 
(returnVal.format() + '.00'));

}

Above is the snippet of code which is trying to return $ and currency field.

I worried that will it display $ USD 123 value. As after enabling multicurrency currency fields will display in USD.

4
  • What is your question about this code? You are correct that any hard-coded currency identifiers will remain hard-coded after enabling multicurrency.
    – David Reed
    Jul 4, 2019 at 1:50
  • @david , in old quoting tool there was a currency field, which automatically populates the "$" infront of the value. But now new cpq tool offers a currency field, which u can choose specific type of currency at the time of field creation.
    – teeshu
    Jul 4, 2019 at 4:34
  • So my question, is if there was a old apex code , which appends a "$" to a value, how would that behave with new cpq tool.
    – teeshu
    Jul 4, 2019 at 4:35
  • on new cpq tool, would it display like USD $325 ? where as in old quoting tool it used to display just $325.
    – teeshu
    Jul 4, 2019 at 4:37

1 Answer 1

0

Because the code snippet returns a string, anywhere this is displayed will simply look like

$325

I'm guessing that the code fragment you are showing is for a VF page/controller

CPQ (and for that matter, the rest of SFDC) will display for all fields of type currency:

USD 325.00 or
EUR 325.00 or
GBP 325.00 ...

You shouldn't see USD $325 anywhere. But you may see on some Euro quote's custom VF pages or text fields value: $325 and elsewhere you will see EUR 325. Discovering all places will be the fun part.

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.