How would one get the values available values of a System Custom Field?

Here are the details of the "System Custom Field":

Field Label: "Working Status"

Field Name: "Working_Status"

API Name: Working_Status__c

Object Name: "System"

Data Type: "Picklist"

Values: { "Running", "Starting Up", "Unknown"}

I am using the following query:

SELECT Values FROM CustomField WHERE ObjectName = 'System.Working_Status__c'

However, this is not working. I can use the describe the Lightning Platform REST API describe method of doing this, but it returns every possibility in the system. https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_sobject_describe.htm

What do I need to change in my SOQL query to make this happen?

2 Answers 2


It's worth noting you don't need any API calls at all to get this information, and can simply use the field describe (which is also accessible via REST API).

List<PicklistEntry> entries = System.Working_Status__c.getDescribe().getPicklistValues();

List<String> values = new List<String>();
for (PicklistEntry entry : entries)
  • The source code you listed does not work, needed to modify it to:
    – Kris
    Commented May 3, 2018 at 21:20
  • List<String> lstPickvals=new List<String>(); Schema.SObjectType tarType = Schema.getGlobalDescribe().get('System__c'); Sobject Object_name = tarType.newSObject(); Schema.sObjectType sobject_type = Object_name.getSObjectType(); Schema.DescribeSObjectResult sobject_describe = sobject_type.getDescribe(); Map<String, Schema.SObjectField> field_map = sobject_describe.fields.getMap(); List<Schema.PicklistEntry> pick_list_values = field_map.get('Working_Status__c').getDescribe().getPickListValues(); for (Schema.PicklistEntry a : pick_list_values) { lstPickvals.add(a.getValue()); }
    – Kris
    Commented May 3, 2018 at 21:20

Yes you can do that using tooling API. You have to specify the ObjectName and FieldName.

If you check metadata for CustomField ObjectName is called as TableEnumOrId and FieldName is called as DeveloperName.

The picklist values/valueset are stored in a field called as "Metadata".

So your SOQL will be.

SELECT Id,NameSpacePrefix, DeveloperName, TableEnumOrId,Metadata FROM CustomField WHERE TableEnumOrId = 'Account' and DeveloperName='License_Type'

When I tried it in workbench it returns the picklist valueset.

Note: Developer Console doesn't support the return of complex return type so you have to view this in Workbench or any other rest client.

*As pointed by @Sfdcfox, When you query metadata you can query a single field at a time.

enter image description here

  • You may want to mention that you can only query one field at a time when using Metadata.
    – sfdcfox
    Commented May 3, 2018 at 19:37
  • Getting error: "message": "\nDeveloperName,TableEnumOrId,Metadata FROM CustomField WHERE TableEnumOrId\n ^\nERROR at Row:1:Column:69\nsObject type 'CustomField' is not supported. If you are attempting to use a custom object, be sure to append the '__c' after the entity name. Please reference your WSDL or the describe call for the appropriate names.",
    – Kris
    Commented May 3, 2018 at 20:51
  • How are you querring? Are you using tooling API? CustomField isn't supported in other API's. Commented May 3, 2018 at 20:55
  • I'm using cURL to do a HTTP GET: https://inst.salesforce.com/services/data/v42.0/query/?q=SELECT+Id,NameSpacePrefix,DeveloperName,TableEnumOrId,Metadata+FROM+CustomField+WHERE+TableEnumOrId+=+%27System%27+and+DeveloperName=%27Working_Status%27
    – Kris
    Commented May 3, 2018 at 21:22
  • Thats URL is normal query URL and not the tooling API query URL. The tooling API querry url is: https://inst.salesforce.com/services/data/v41.0/tooling/query?q=SELECT+Id,NameSpacePrefix,DeveloperName,TableEnumOrId,Metadata+FROM+CustomField+WHERE+TableEnumOrId+=+%27System%27+and+DeveloperName=%27Working_Status%27 Commented May 3, 2018 at 21:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .