I am trying to get and display the picklist option from salesforce, in heroku. Can anyone kindly let me know how I can achieve this.
I am querying records from case. And I want to display the case origin options.
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It only takes a minute to sign up.
Sign up to join this communityYou need to make a GET
request to the SObject Describe REST Endpoint. The large response body includes all the information you'd expect in Apex from the DescribeSobjectResult
and DescribeFieldResult
classes.
GET /services/data/v44.0/sobjects/Account/describe
yields a response body including
{
"name" : "Type",
"picklistValues" : [
{ "active" : true, "defaultValue" : false, "label" : "Prospect", "validFor" : null, "value" : "Prospect" },
{ "active" : true, "defaultValue" : false, "label" : "Customer - Direct", "validFor" : null, "value" : "Customer - Direct" },
...
],
...
}
as part of the list under the key fields
. Much data is omitted above for brevity.
Alternately, consider using the UI API to get back fully-formed details of how to render the user interface for a specific record, including picklist details.