---
schema_version: "1"
id: 3495d156eb3da863528ae4d4f74bfdf7cc4eeb38b231fc0e16051e81fa605591
title: Picklist (Including Dependent Picklist)
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/api_meta/meta_picklist.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_picklist.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 3a22685fff7d5059694e375911798fa8a7a32834b74860ad9d5b781e97a065bd
description: Deprecated. Represents a picklist (or dependent picklist) definition for a custom field in a custom object or a custom or standard field in a standard object, such as an account.
---
# Picklist (Including Dependent Picklist)

Deprecated. Represents a picklist (or dependent picklist) definition for a custom field in a custom object or a custom or standard field in a standard object, such as an account.

## Version

Use this type in API version 37.0 and earlier only. Picklists for custom fields in custom objects are available in API version 12.0 and later. Picklists for custom or standard fields in standard objects, such as accounts, are available in API version 16.0 and later.

In API version 38.0 and later, Picklist is replaced by [ValueSet](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_field_types.htm#valueSet) on the CustomField type.

## Declarative Metadata File Suffix and Directory Location

Picklist definitions are included in the custom object and field with which they’re associated.

## Fields

Picklist contains the following fields:

<table class="featureTable sort_table" summary="">



          <thead class="thead sorted" align="left">
            <tr>
              <th class="featureTableHeader  " id="d746444e87">Field Name</th>

              <th class="featureTableHeader  " id="d746444e90">Field Type</th>

              <th class="featureTableHeader  " id="d746444e93">Description</th>

            </tr>

          </thead>

          <tbody class="tbody">
            <tr>
              <td class="entry" headers="d746444e87" data-title="Field Name"><span class="keyword parmname">controllingField</span></td>

              <td class="entry" headers="d746444e90" data-title="Field Type">string</td>

              <td class="entry" headers="d746444e93" data-title="Description">The <a class="xref" href="https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/customfield.htm#field_fullName"><span class="keyword parmname">fullName</span></a> of the
                controlling field if <span class="keyword parmname">controllingField</span> is a
                dependent picklist. A dependent picklist works in conjunction with a
                controlling picklist or checkbox to filter the available options.
                The value chosen in the controlling field affects the values
                available in the dependent field. This field is available in API
                version 14.0 and later.</td>

            </tr>

            <tr>
              <td class="entry" headers="d746444e87" data-title="Field Name"><span class="keyword parmname">picklistValues</span></td>

              <td class="entry" headers="d746444e90" data-title="Field Type">PicklistValue[]</td>

              <td class="entry" headers="d746444e93" data-title="Description">
                <p class="p">Required. Represents a set of values for a picklist.</p>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d746444e87" data-title="Field Name"><span class="keyword parmname">restrictedPicklist</span></td>

              <td class="entry" headers="d746444e90" data-title="Field Type">boolean</td>

              <td class="entry" headers="d746444e93" data-title="Description">
                <span class="ph" id="Picklist_restrictedPicklist_descr"><a name="Picklist_restrictedPicklist_descr"><!-- --></a>Indicates whether the
                  picklist’s value list is restricted. With a restricted picklist,
                  only an admin can add or change values; users can’t load or
                  remove values through the API. By default this value is <samp class="codeph nolang">false</samp>.</span>
                <p class="p">This field is
                  available in API version 37.0 and later.</p>
              </td>

            </tr>

            <tr>
              <td class="entry" headers="d746444e87" data-title="Field Name"><span class="keyword parmname">sorted</span></td>

              <td class="entry" headers="d746444e90" data-title="Field Type">boolean</td>

              <td class="entry" headers="d746444e93" data-title="Description">
                <p class="p">Indicates whether values are sorted (<samp class="codeph java">true</samp>), or not (<samp class="codeph java">false</samp>). By default this value is <samp class="codeph nolang">false</samp>.</p>

              </td>

            </tr>

          </tbody>

        </table>

## Java Sample

The following sample uses a picklist. For a complete sample of using a picklist with record types and profiles, see [Profile](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_profile.htm "Represents a user profile. A profile defines a user’s permission to perform different functions within Salesforce. This type extends the Metadata metadata type and inherits its fullName field.").

public void setPicklistValues() {
  // Create a picklist
  Picklist expenseStatus = new Picklist();
  PicklistValue unsubmitted = new PicklistValue();
  unsubmitted.setFullName("Unsubmitted");
  PicklistValue submitted = new PicklistValue();
  submitted.setFullName("Submitted");
  PicklistValue approved = new PicklistValue();
  approved.setFullName("Approved");
  PicklistValue rejected = new PicklistValue();
  rejected.setFullName("Rejected");
  expenseStatus.setPicklistValues(new PicklistValue\[\]
      {unsubmitted, submitted, approved, rejected});
  
  CustomField expenseStatusField = new CustomField();
  expenseStatusField.setFullName(
      "ExpenseReport\_\_c.ExpenseStatus\_\_c");
  expenseStatusField.setLabel("Expense Report Status");
  expenseStatusField.setType(FieldType.Picklist);
  expenseStatusField.setPicklist(expenseStatus);
  try {
    AsyncResult\[\] ars =
    metadataConnection.create(new Metadata\[\] {expenseStatusField});
  } catch (ConnectionException ce) {
    ce.printStackTrace();
  }
}

## Declarative Metadata Sample Definition

The following sample shows usage for picklists, including dependent picklists, in a custom object. The isAmerican\_\_c checkbox controls the list of manufacturers shown in the manufacturer\_\_c picklist. The manufacturer\_\_c checkbox in turn controls the list of models shown in the model\_\_c picklist.

<?xml version="1.0" encoding="UTF-8"?>
<CustomObject xmlns="http://soap.sforce.com/2006/04/metadata">
    <deploymentStatus\>Deployed</deploymentStatus\>
    <enableActivities\>true</enableActivities\>
    <fields\>
        <fullName\>isAmerican\_\_c</fullName\>
        <defaultValue\>false</defaultValue\>
        <label\>American Only</label\>
        <type\>Checkbox</type\>
    </fields\>
    <fields\>
        <fullName\>manufacturer\_\_c</fullName\>
        <label\>Manufacturer</label\>
        <picklist\>
            <controllingField\>isAmerican\_\_c</controllingField\>
            <picklistValues\>
                <fullName\>Chrysler</fullName\>
                <controllingFieldValues\>checked</controllingFieldValues\>
                <default\>false</default\>
            </picklistValues\>
            <picklistValues\>
                <fullName\>Ford</fullName\>
                <controllingFieldValues\>checked</controllingFieldValues\>
                <default\>false</default\>
            </picklistValues\>
            <picklistValues\>
                <fullName\>Honda</fullName\>
                <controllingFieldValues\>unchecked</controllingFieldValues\>
                <default\>false</default\>
            </picklistValues\>
            <picklistValues\>
                <fullName\>Toyota</fullName\>
                <controllingFieldValues\>unchecked</controllingFieldValues\>
                <default\>false</default\>
            </picklistValues\>
            <sorted\>false</sorted\>
        </picklist\>
        <type\>Picklist</type\>
    </fields\>
    <fields\>
        <fullName\>model\_\_c</fullName\>
        <label\>Model</label\>
        <picklist\>
            <controllingField\>manufacturer\_\_c</controllingField\>
            <picklistValues\>
                <fullName\>Mustang</fullName\>
                <controllingFieldValues\>Ford</controllingFieldValues\>
                <default\>false</default\>
            </picklistValues\>
            <picklistValues\>
                <fullName\>Taurus</fullName\>
                <controllingFieldValues\>Ford</controllingFieldValues\>
                <default\>false</default\>
            </picklistValues\>
            <picklistValues\>
                <fullName\>PT Cruiser</fullName\>
                <controllingFieldValues\>Chrysler</controllingFieldValues\>
                <default\>false</default\>
            </picklistValues\>
            <picklistValues\>
                <fullName\>Pacifica</fullName\>
                <controllingFieldValues\>Chrysler</controllingFieldValues\>
                <default\>false</default\>
            </picklistValues\>
            <picklistValues\>
                <fullName\>Accord</fullName\>
                <controllingFieldValues\>Honda</controllingFieldValues\>
                <default\>false</default\>
            </picklistValues\>
            <picklistValues\>
                <fullName\>Civic</fullName\>
                <controllingFieldValues\>Honda</controllingFieldValues\>
                <default\>false</default\>
            </picklistValues\>
            <picklistValues\>
                <fullName\>Prius</fullName\>
                <controllingFieldValues\>Toyota</controllingFieldValues\>
                <default\>false</default\>
            </picklistValues\>
            <picklistValues\>
                <fullName\>Camry</fullName\>
                <controllingFieldValues\>Toyota</controllingFieldValues\>
                <default\>false</default\>
            </picklistValues\>
            <sorted\>false</sorted\>
        </picklist\>
        <type\>Picklist</type\>
    </fields\>
....
</CustomObject\>

The following sample shows usage for the standard Stage field in opportunities.

<?xml version="1.0" encoding="UTF-8"?>
<CustomObject xmlns="http://soap.sforce.com/2006/04/metadata">
    <fields\>
        <fullName\>StageName</fullName\>
        <picklist\>
            <picklistValues\>
                <fullName\>Prospecting</fullName\>
                <default\>false</default\>
                <forecastCategory\>Pipeline</forecastCategory\>
                <probability\>10</probability\>
            </picklistValues\>
            <picklistValues\>
                <fullName\>Qualification</fullName\>
                <default\>false</default\>
                <forecastCategory\>Pipeline</forecastCategory\>
                <probability\>10</probability\>
            </picklistValues\>
            <picklistValues\>
                <fullName\>Needs Analysis</fullName\>
                <default\>false</default\>
                <forecastCategory\>Pipeline</forecastCategory\>
                <probability\>20</probability\>
            </picklistValues\>
            ...
        </picklist\>
    </fields\>
<CustomObject\>

## Wildcard Support in the Manifest File

This metadata type doesn’t support the wildcard character \* (asterisk) in the package.xml manifest file. For information about using the manifest file, see [Deploying and Retrieving Metadata with the Zip File](https://developer.salesforce.com/docs/atlas.en-us.264.0.api_meta.meta/api_meta/file_based_zip_file.htm).

- [← Previous](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/namedfilter.htm "NamedFilter")
- [Next →](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_profilesearchlayouts.htm "ProfileSearchLayouts")