+ Start a Discussion
sgottreusgottreu 

Use Apex to pull values from a picklist

My client wants to have a quote with items sub-divided by product family.  How would I access the values in the ProductFamily picklist using Apex?  The questions I have seen on this were before the Summer '09 release.  Has anything been updated?
Best Answer chosen by Admin (Salesforce Developers) 
Kirtesh_JainKirtesh_Jain

Hi

 

 

The solution to this one is listed in the documentation as:

 

Schema.DescribeFieldResult F = Account.Industry.getDescribe();

List P = F.getPicklistValues(); Each picklistEntry then has getLabel and getValue methods.

 

 

 

thanks

Kirtesh

All Answers

wesnoltewesnolte

Hey

 

The solution to this one is listed in the documentation as:

 

Schema.DescribeFieldResult F = Account.Industry.getDescribe();
List<Schema.PicklistEntry> P = F.getPicklistValues();

 Each picklistEntry then has getLabel and getValue methods.

 

Cheers,

Wes

Kirtesh_JainKirtesh_Jain

Hi

 

 

The solution to this one is listed in the documentation as:

 

Schema.DescribeFieldResult F = Account.Industry.getDescribe();

List P = F.getPicklistValues(); Each picklistEntry then has getLabel and getValue methods.

 

 

 

thanks

Kirtesh

This was selected as the best answer