You need to sign in to do that
Don't have an account?
Brian MacMillan
Querying the source of a picklist field.
I have created a custom field in the account table which is populated by a picklist. I need to query the value of the picklist itself, not the field which it populates. How do I do this? Is there a custom fields object/table I can query? If so, how do I find out the source field's name?
*** Please note, I want to query the source from which I select values for the field, not the custom field itself. ***
*** Please note, I want to query the source from which I select values for the field, not the custom field itself. ***
List<SelectOption> options = new List<SelectOption>();
Schema.DescribeFieldResult fieldResult = Contact.PMOC__c.getDescribe();
List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues();
for( Schema.PicklistEntry f : ple)
{
system.debug( 'Label:' + f.getLabel() +'Value: ' + f.getValue());
}
Here is a link to metadata API https://www.salesforce.com/us/developer/docs/api_meta/Content/meta_picklist.htm.
This link should help you too http://www.salesforce.com/us/developer/docs/api/index_Left.htm#StartTopic=Content/sforce_api_calls_describesobjects.htm with Java and C# examples.
For PHP https://developer-salesforce-com.secure.firelayers.com/forums?id=906F00000008sudIAA shows an example: Hope this helps,
Fred
If these answers helped you solve your problem, please, mark the question as Solved and kindly select the best one ;)
Thanks,
Fred