• dinesh angari
  • NEWBIE
  • 0 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 3
    Replies
Hi All,

I am using Metadata API to update picklist value.
Using SOAP UI to use metadata WSDL, Below is my request to update picklist values. When I am running below request it's creating new picklist values but deactivating existing picklist values...

Please help me what I am missing in below request or Is there any way to insert new values in piclist.


<soapenv:Envelope 
                xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
                xmlns:met="http://soap.sforce.com/2006/04/metadata" 
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Header>
      <met:AllOrNoneHeader>
      </met:AllOrNoneHeader>
      <met:CallOptions>
      </met:CallOptions>
      <met:SessionHeader>
         <met:sessionId>XXXXXXXXXXXXXXXXXXXX</met:sessionId>
      </met:SessionHeader>
   </soapenv:Header>
   <soapenv:Body>
      <met:updateMetadata xmlns="http://soap.sforce.com/2006/04/metadata">
         <!--Zero or more repetitions:-->
         <met:metadata xsi:type = "CustomField">
        <fullName>Account.salaryDay_c__c</fullName>
        <externalId>false</externalId>
        <label>payday</label>
        <required>false</required>
        <trackTrending>true</trackTrending>
        <type>Picklist</type>
        <valueSet>
            <restricted>false</restricted>
            <valueSetDefinition>
                <sorted>false</sorted>
                <value>
                    <fullName>varun3</fullName>
                    <label>varun3</label>
                </value>
            </valueSetDefinition>
        </valueSet>
         </met:metadata>
      </met:updateMetadata>
   </soapenv:Body>
</soapenv:Envelope>

Thanks in Advance..................
Hi All,

I am using Metadata API to update picklist value.
Using SOAP UI to use metadata WSDL, Below is my request to update picklist values. When I am running below request it's creating new picklist values but deactivating existing picklist values...

Please help me what I am missing in below request or Is there any way to insert new values in piclist.


<soapenv:Envelope 
                xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
                xmlns:met="http://soap.sforce.com/2006/04/metadata" 
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Header>
      <met:AllOrNoneHeader>
      </met:AllOrNoneHeader>
      <met:CallOptions>
      </met:CallOptions>
      <met:SessionHeader>
         <met:sessionId>XXXXXXXXXXXXXXXXXXXX</met:sessionId>
      </met:SessionHeader>
   </soapenv:Header>
   <soapenv:Body>
      <met:updateMetadata xmlns="http://soap.sforce.com/2006/04/metadata">
         <!--Zero or more repetitions:-->
         <met:metadata xsi:type = "CustomField">
        <fullName>Account.salaryDay_c__c</fullName>
        <externalId>false</externalId>
        <label>payday</label>
        <required>false</required>
        <trackTrending>true</trackTrending>
        <type>Picklist</type>
        <valueSet>
            <restricted>false</restricted>
            <valueSetDefinition>
                <sorted>false</sorted>
                <value>
                    <fullName>varun3</fullName>
                    <label>varun3</label>
                </value>
            </valueSetDefinition>
        </valueSet>
         </met:metadata>
      </met:updateMetadata>
   </soapenv:Body>
</soapenv:Envelope>

Thanks in Advance..................

Hello,

 

I am trying to update picklist values but SOapUI is throwing error

 

MY Request:

 

--------------------------

 

   <soapenv:Header>
    <met:CallOptions>
         <met:client></met:client>
      </met:CallOptions>
      <met:SessionHeader>
         <met:sessionId>-----</met:sessionId>
      </met:SessionHeader>
   </soapenv:Header>
   <soapenv:Body>
      <met:update>
         <!--Zero or more repetitions:-->
         <met:UpdateMetadata>
            <met:currentName>Account.test_field2__c</met:currentName>
            <met:metadata>
               <!--Optional:-->
               <met:fullName>Account.test_field2__c</met:fullName>
                <met:label>test field2</met:label>
    <met:picklist>
             <met:picklistValues>
        <met:fullName>five</met:fullName>
             </met:picklistValues>
        <met:sorted>false</met:sorted>
  </met:picklist>
        <met:type>Picklist</met:type>
    </met:metadata>
         </met:UpdateMetadata>
      </met:update>
   </soapenv:Body>
</soapenv:Envelope>
 
Error:
----------
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:Body>
      <soapenv:Fault>
         <faultcode>soapenv:Client</faultcode>
         <faultstring>Must specify a {http://www.w3.org/2001/XMLSchema-instance}type attribute value for the {http://soap.sforce.com/2006/04/metadata}metadata element</faultstring>
      </soapenv:Fault>
   </soapenv:Body>
</soapenv:Envelope>
 
One more thing I am not sure what should be the value in the <met:client></met:client>
 
Please suggest.
 

 Does anyone know how to update picklist value from metadata api?

 I wrote an xml message as followings referring http://www.salesforce.com/us/developer/docs/api_meta/index.htm, but it does not work well.

 

In this case, with the first picklist values that currentname and fullname are different,  it supposed to be updating the picklist  value. but on the contrary as result, this picklist would have 3 picklist values -

"next month", "this month", "xxxx".

 

 The value of "this month" is being treated as new picklist value...any clue on this..?

 

*********************

<soapenv:Body>
 <update>
  <UpdateMetadata>
  <currentName>Account.salaryDay__c</currentName>
  <metadata xsi:type="ns2:CustomField">
    <fullName>Account.salaryDay__c</fullName>
    <label>payday</label>
    <type>Picklist</type>
    <picklist>
     <sorted>true</sorted>
     <picklistValues>
      <currentName>next month</currentName>
      <fullName>this month</fullName>
     </picklistValues>
     <picklistValues>
      <currentName>xxxx</currentName>
      <fullName>xxxx</fullName>
     </picklistValues>

   ....

   </soapenv:Body>
  </update>
 </UpdateMetadata>

*********

 

Thank you so much