Reputation: 87
I'm able to get the picklist values from the standard object (e.g: Contact, Account), but when I use the same way to a custom object (Event), it always return 0 result. Need the help to get the some picklist values from the event.
Note: I need ALL values available from a picklist field in the object. Example: all country list under Country__c (which is a picklist type) in the event.
The ways I tried:
way 1: directly write SOQL to get the info SELECT Label,Value FROM PicklistValueInfo WHERE EntityParticle.EntityDefinition.QualifiedApiName = 'APINameOfObject' AND EntityParticle.QualifiedApiName = 'APINameOfField' and isActive = true LIMIT 1000
Way 2: make an REST API to get describe info back https://my.salesforce.com/services/data/v44.0/sobjects/Contact/describe (can see each picklist description with all values listed for Contact) https://my.salesforce.com/services/data/v44.0/sobjects/Event/describe (can't get the picklist name/values return even I could see it in the Salesforce portal)
Way 3: SOQL to get label, value, DurableId info fro EntityDefinition and PicklistValueInfo Way 4: SOQL in the API https://{domainurl}.my.salesforce.com/services/data/v44.0/query/?q=SELECT Id, Label, Value,DurableId from PicklistValueInfo WHERE EntityParticleId = 'Account.Industry'
I asked my Salesforce Admin and confirmed there is no such way to "block" the picklist values return, the custom object should behave as same as the stand ones.
Thanks so much to read through my question!
Upvotes: 1
Views: 1878
Reputation: 87
Updates:
for the custom object, I need to use Event__c
instead of Event
, so the working soql is:
SELECT Label,Value FROM PicklistValueInfo WHERE EntityParticle.EntityDefinition.QualifiedApiName = '**Event__c**' AND EntityParticle.QualifiedApiName = 'Country__c' and isActive = true LIMIT 1000
earlier I used: QualifiedApiName = '**Event**'
which doesn't work, Account
is a standard object that's why it works.
Upvotes: 1