3

Is it possible to create a custom picklist field with different value and name. Eg on the page layout Orange,Banana value saved in db 0,1. Thanks

3 Answers 3

5

No, it's not.

You need a second field to achieve this functionality, probably a formula field but you could also have a text / number field which is updated via workflow.

The formula would look something like this:

Case (
    Text(MyPicklist__c),
    'Orange', 0
    'Banana', 1,
    0
)
2
  • 1
    Thanks. Your solution looks promising will implement it and get back to you if i face any problem. Sep 1, 2014 at 13:50
  • See below this is doable as of Spring '17 if you have different API names and Labels on the Picklist Values. Jan 13, 2017 at 17:14
4

You would need to use VF to do this as you can't do this on the standard page. You can take a look at the documentation here.

VF Code

 <apex:selectList value="{!myChoice}">
      <apex:selectOptions value="{!choices}"/>
 </apex:selectList><p/>

Controller Code

public Integer myChoice {get;set;}

public List<SelectOption> getChoices() {
    List<SelectOption> choices = new List<SelectOption>();
    options.add(new SelectOption(0,'Orange'));
    options.add(new SelectOption(1,'Banana'));
    options.add(new SelectOption(2,'Some Other Fruit'));
    return choices;
}
3

This is possible in Spring '17 - Value Labels Are No Longer Tied to API Names.

You can have a different API Name and Label for each picklist value.

You must log in to answer this question.

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