salesforcesoqlpicklist

How to Export all picklist field of object along the picklist lable and API AND DEFAULT VALUE


I have more than 100 picklist fields on object and I have to import all picklist fields along the their label, API Name, can anyone please help.

I have tried below fetching through field definition and picklistValue info but it doesn't work me. example below

SELECT isdefaultValue,durableId,EntityParticle.DeveloperName, EntityParticle.DataType, validFor, label,value FROM PicklistValueInfo Where entityParticleId IN ('Case.Type', 'Case.Status','Case.Reason','Case.Origin',)

There is no issue with Query however putting more than 100+ fields would not be right solution. I have way beyond in other object.

Looking for an immediate support please


Solution

  • You want all Case picklist values without actually spelling the fields out, right?

    You already used a relationship (like JOIN in normal database) for EntityParticle.DeveloperName, EntityParticle.DataType. Go "up" one more time to EntityDefinition table

    SELECT DurableId, EntityParticle.DeveloperName, EntityParticle.DataType, ValidFor, Label, Value, IsDefaultValue
    FROM PicklistValueInfo 
    WHERE EntityParticle.EntityDefinition.DeveloperName = 'Case'
    ORDER BY DurableId