function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Saikat GangulySaikat Ganguly 

Is there any way to get picklist values or value's id from picklistValueInfo using SOQL? Or a way to get picklist Value's id

Daniel BallingerDaniel Ballinger

You could get that sort of Metadata in SOQL via the Tooling API.

Select Id,DurableId,QualifiedApiName,EntityDefinitionId,NamespacePrefix,DeveloperName,DataType,Metadata,FullName from FieldDefinition WHERE EntityDefinition.QualifiedApiName = 'Account' AND QualifiedApiName = 'Industry'

The Metadata field will contain the Custom Field Metadata, which includes the Picklist Metadata and values.

You can also get this data in Apex using the Describe calls, or via the Partner API using the metadata describe calls.
Saikat GangulySaikat Ganguly
Hey Daniel,
Thanks for your precious time you spent to solve this issue.
Actully now the issue is I tried to run that SOQL query on 'workbench.developerforce.com' and on execute an error occur.Below is the screen shot. Also i didn't find any filed with name  - Metadata in FieldDefinition sObject on workbench.
User-added image
On other hand i try to  get an id of values from a picklist through this query and got success in that: 
SELECT Id,isdefaultValue,durableId,validFor, label,value FROM PicklistValueInfo  Where  entityParticleId='Case.Priority'.

This query is executing and returning the IDs.But here another issue is that the id i got after execution of this query is getting changed on every update in values. what i mean is that,  if i update a picklist value from HIGH to HIGHER then salesforece update all values with HIGH to its new i.e. HIGHER and at the same time id of HIGHER will also get updated. So how could i find if there is a permanent id.

We need this id as we are trying to import data from SFDC to an external application and maintain SFDC data in a relational database. So if any picklist value is getting changed we need to reflect the changed value in all relational tables in our system. 

So my question is how can I get permanent ID value for each picklist values ?

Thanks
Saikat
 
Matti SchviliMatti Schvili
This might be a half answer for you
https://success.salesforce.com/ideaView?id=08730000000bBlSAAU

As long as you only update the Value and keep the API Name. Would it work for you?