Is there any reason or counter-measure against the fact that Currency picklist values are different on VF pages than on Standard Layouts?

Standard Layout Edit Mode:

enter image description here

VF page with apex:inputField:

enter image description here

  • There is a standard field in salesforce called CurrencyISOCode. You can put it on your layout. – developer__c Dec 5 '14 at 11:42
  • That's what I am doing already?! – Robert Sösemann Dec 5 '14 at 12:01
  • 1
    Ok. Can you try using that and see if you get it right ? – Amit Bangad Dec 5 '14 at 13:37
  • 1
    @AmitBangad: Sorry but this is a somewhat lame answer "Use outputfields" when someone is having problems with input fields :-( – Robert Sösemann Dec 5 '14 at 14:10
  • 2
    According to this Apex Doc the picklist Label that's needed is Currency ISO Code to get the 3 letter choices used in the standard page layouts provided your org has them enabled. – crmprogdev Dec 5 '14 at 17:05

We can fulfill this requirment by our custom describe Sobject call. I would like to provide you the working code/solution for this problem. Code is given below:-

Visualforce page:-

<apex:form >
    <apex:pageBlock title="Currency ISO Code">   
    <apex:pageBlockSection >
        <apex:pageBlockSectionItem >
            <apex:selectList id="countries" value="{!Opportunity.CurrencyIsoCode}" size="1" required="true">
              <apex:selectOptions value="{!CurrencyValues}"/>

Apex Class:-

public class CurrencyClass{

    public CurrencyClass (ApexPages.StandardController ctr){

    public List<SelectOption> getCurrencyValues()
      List<SelectOption> options = new List<SelectOption>();

       Schema.DescribeFieldResult fieldResult = Opportunity.CurrencyIsoCode.getDescribe();

       List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues();

       for( Schema.PicklistEntry f : ple)
          //Concatinating currency values like  ( value "USD" label "U.S. Dollar" ) 

          string finalvalue= f.getValue() + ' - ' + f.getLabel() ;

          options.add(new SelectOption(finalvalue, finalvalue));
       return options;

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