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>
  • What version of the API are you using? – John Towers Mar 3 '17 at 17:01
  • using version 38.0 – nevrekar_amey Mar 3 '17 at 17:02
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
<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
    globalPicklist is only available in version 37.0 of the API. It has been replaced by valueSet. – John Towers Mar 3 '17 at 17:27
  • Thanks for pointing that. I extracted this snippet using the Force-CLI, which apparently was discontinued. :( Sad! – Renato Oliveira Mar 3 '17 at 17:34

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.