0

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.

1 Answer 1

0

You 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.

You must log in to answer this question.

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