You need to sign in to do that
Don't have an account?
Tomeka Wray
Help in Retrieving Picklist Values from State field on Lead Object
I am trying to grab the picklist values from the State field on my Lead object. The State field is part of the Address date type. The following code returns nothing:
List<Schema.PicklistEntry> fieldResult = Lead.State.getDescribe().getPicklistValues(); system.debug('States = ' + fieldResult); Map<string,string> options = new Map<string,string>(); for( Schema.PicklistEntry f : fieldResult ) { options.put(f.getLabel(),f.getLabel()); system.debug('State =' + f.getLabel()); }
If you are using the State and Country picklists, you can retrieve the picklist values from the StateCode field.
All Answers
you see here state field is not pick list
I think you want status field values. if so, you can use this code
you can use it for any Picklist
good luck
If you are using the State and Country picklists, you can retrieve the picklist values from the StateCode field.
I get error msg "statecode is not a field of Lead".
You will have to enable State and Country picklist to be able to use the field.
Do you know how I can just retrive the states from the United states? Statecode returns all states for each country. Thanks.