[SalesForce] DEPLOYMENT FAILED: Picklist attribute required on create

I have the following metadata for my custom object

   <fields>
        <fullName>Meter_Type__c</fullName>
        <externalId>false</externalId>
        <label>Creative Type</label>        
        <trackHistory>false</trackHistory>
        <trackTrending>false</trackTrending>
        <type>Picklist</type>
    </fields>

When I try to deploy I get the following error:

Picklist attribute required on create

I'm using MavensMate, so I went ahead and open the custom object and modified the metadata to this:

  <fields>
        <fullName>Meter_Type__c</fullName>
        <externalId>false</externalId>
        <label>Creative Type</label>
        <required>false</required>
        <trackHistory>false</trackHistory>
        <trackTrending>false</trackTrending>
        <type>Picklist</type>
    </fields>

If I add the required = false got the following error:

Picklist attribute required on create

Then I add required = true got the following error:

 <fields>
    <fullName>Meter_Type__c</fullName>
    <externalId>false</externalId>
    <label>Creative Type</label>
    <required>true</required>
    <trackHistory>false</trackHistory>
    <trackTrending>false</trackTrending>
    <type>Picklist</type>
</fields>

Can not specify 'required' for a CustomField of type Picklist

I have tried with both Eclipse & MavensMate to deploy to my sandbox but I could not go further stuck with this error, not sure how to resolve!

What solutions have other people used to get around this?

Best Answer

Here is a picklist field example from a custom object that I know will deploy:

<fields>
    <fullName>Status__c</fullName>
    <deprecated>false</deprecated>
    <externalId>false</externalId>
    <label>Status</label>
    <picklist>
        <picklistValues>
            <fullName>Pending</fullName>
            <default>false</default>
        </picklistValues>
        <picklistValues>
            <fullName>Open</fullName>
            <default>false</default>
        </picklistValues>
        <picklistValues>
            <fullName>Closed</fullName>
            <default>false</default>
        </picklistValues>
        <picklistValues>
            <fullName>Incomplete</fullName>
            <default>false</default>
        </picklistValues>
        <sorted>false</sorted>
    </picklist>
    <trackFeedHistory>false</trackFeedHistory>
    <trackHistory>true</trackHistory>
    <trackTrending>false</trackTrending>
    <type>Picklist</type>
</fields>

You appear to be missing the picklist entry values for some reason - short term you could manually add at least one of them to get the field to deploy.

Related Topic