Find your content:

Search form

You are here

REST API: How to retrieve active values for picklist?

 
Share

I am trying to access just the "Selected" picklist values for a field using the REST API via the databasedotcom Ruby gem.

In the normal SFDC interface, a user can navigate to "Campaigns > Record Types > MyRecordTypeOfChoice > Picklists Available for Editing > Edit" and move items between the Available Values and Selected Values lists.

However, when I do client.materialize("Campaign").picklist_values("MyFieldOfInterest"), I get a combined list of the values in Available Values and Selected Values with no indication of which values came from which list.

Is it possible to retrieve only the Selected/Active Picklist Values using the SFDC REST API?


Attribution to: user540146

Possible Suggestion/Solution #1

There have been similar questions before, for example https://stackoverflow.com/questions/7810801/how-to-describe-enumerate-picklist-enties-valid-for-a-specific-record-type-in

I don't think it's possible. REST API will only let you learn the relationships between dependent picklists (which values in child are valid for which values on parent) and if you need that - you can read about it in Get lists of dependent picklist options in Apex

To obtain info about availability per record type you'll have to use Metadata API (either to download the object definition like *.object files in Eclipse IDE or issuing a describeLayout() call). Both of these aren't available from pure Apex so creation of smart service exposed as REST is also not a valid solution.

If hand-crafting SOAP sounds like too much hassle - install Eclipse IDE to familiarize yourself with the *.object files and if you think these XMLs look workable you could always write some scripting around Migration Tool that's able to download this info without the burden of clumsy IDE.


I've heard some gossip about Salesforce guys working on "Tooling API" that should be easier to use than what we have now... fingers crossed, safe harbor blah blah blah ;)


Attribution to: eyescream

Possible Suggestion/Solution #2

It's possible through the services API (Which is soap based). You can use my Metaforce gem to do this.


Attribution to: ejholmes
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/4834

My Block Status

My Block Content