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

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
)
| 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 '14 at 13:50
  • See below this is doable as of Spring '17 if you have different API names and Labels on the Picklist Values. – Charles Koppelman Jan 13 '17 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;
}
| improve this answer | |
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.

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