Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

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

share|improve this question

2 Answers 2

up vote 3 down vote accepted

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
)
share|improve this answer
1  
Thanks. Your solution looks promising will implement it and get back to you if i face any problem. –  Shanker Paudel Sep 1 at 13:50

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;
}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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