Module: Restforce::Concerns::Picklists

Included in:
Data::Client
Defined in:
lib/restforce/concerns/picklists.rb

Defined Under Namespace

Classes: PicklistValues

Instance Method Summary collapse

Instance Method Details

#picklist_values(sobject, field, options = {}) ⇒ Object

Public: Get the available picklist values for a picklist or multipicklist field.

sobject - The String name of the sobject. field - The String name of the picklist/multipicklist field. options - A hash of options. (default: {}).

:valid_for - If specified, will only return picklist values
             that are valid for the controlling picklist
             value

Examples

client.picklist_values('Account', 'Type')
# => [#<Restforce::Mash label="Prospect" value="Prospect">]

# Given a custom object named Automobile__c with picklist fields
# Model__c and Make__c, where Model__c depends on the value of
# Make__c.
client.picklist_values('Automobile__c', 'Model__c', :valid_for => 'Honda')
# => [#<Restforce::Mash label="Civic" value="Civic">, ... ]

Returns an array of Restforce::Mash objects.



27
28
29
# File 'lib/restforce/concerns/picklists.rb', line 27

def picklist_values(sobject, field, options = {})
  PicklistValues.new(describe(sobject)['fields'], field, options)
end