1

I have created a GlobalValueSet using salesforce metadata api. Now I am creating a new field on a existing object using SF metadata api which is going to use this GlobalValueSet, but somehow its failing to deploy giving me following error : Error: You must specify either picklist, globalPicklist, or valueSet.

Following is object field metadata and I tried using all the types ex: valueSet, globalPicklist, globalValueSet possible to get through this, but none works. Anyone has a idea how do we reference GlobalValueSets when creating a new picklist field ?

<fields>
    <fullName>global_time__c</fullName>
    <externalId>false</externalId>
    <label>global time</label>
    <required>false</required>
    <trackTrending>false</trackTrending>
    <valueSet>Start_End_Time__c</valueSet>
    <type>Picklist</type>
</fields>
2
  • What version of the API are you using? Mar 3, 2017 at 17:01
  • using version 38.0 Mar 3, 2017 at 17:02

2 Answers 2

4

<valueSet> isn't just a value. It requires more. It should be:

<valueSet>
  <restricted>true</restricted>
  <valueSetName>Start_End_Time__c</valueSetName>
</valueSet>
0
0
<fields>
    <fullName>YourPicklistField__c</fullName>
    <description>Field description</description>
    <externalId>false</externalId>
    <globalPicklist>GlobalPicklistName</globalPicklist>
    <inlineHelpText>Helptext text.</inlineHelpText>
    <label>The field Label goes here</label>
    <required>false</required>
    <trackHistory>false</trackHistory>
    <trackTrending>false</trackTrending>
    <type>Picklist</type>
</fields>

This is how the field metadata is retrieved from the organization. You should use globalPicklist.

Information on how to describe the value set can be found here.

2
  • 2
    globalPicklist is only available in version 37.0 of the API. It has been replaced by valueSet. Mar 3, 2017 at 17:27
  • Thanks for pointing that. I extracted this snippet using the Force-CLI, which apparently was discontinued. :( Sad! Mar 3, 2017 at 17:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .