6

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?

2
  • Did you try with the picklist which has different value in 'Available' and 'Selected' list? – Priyanka Nov 28 '12 at 4:56
  • @Priyanka I'm not sure I understand the question. As far as I am aware, the values in the "Available" and "Selected" lists are always different, with the ability to move them between one and the other via the "Add" and "Remove" buttons. – user540146 Nov 28 '12 at 17:17
4

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 ;)

1

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

1
  • Metaforce looks great! What would be the Metaforce equivalent of client.materialize("Campaign").picklist_values("MyFieldOfInterest")? – user540146 Nov 30 '12 at 17:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.