function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
msimondsmsimonds 

Problems with the Meta Data API

Nick,
 
Maybe I need to rephrase my Subject line, but I see some shortcomings using the metadata API.  In your example you have:
 
$customObject->setDescription("A description");
 
AND
 
$customField->setDescription('Description of New Field');
 
 
 
to set the descriptions on the new object and field(s), but the shortcoming is that a developer cannot get the description from one organization to another.  So if I have a custom object with a description in my production org/instance, I cannot move that to another org/instance or am I missing this somewhere?
 
~Mike
msimondsmsimonds
Also there seems to be another problem with the MetaData API.  When you create a custom field inside your instance of Salesforce, you can create a lookup to another object.  This sets the Type to Reference in the API. 

When I try to create a custom field using this in the PHPToolKit I get this error:

'reference' is not a valid value for the enum 'FieldType'



So it seems to me that the MetaData API is limited based on my preliminary tests!


~Mike


Message Edited by msimonds on 04-22-2008 09:53 AM
msimondsmsimonds
bump

Anyone???

Are there limitations to the API on what kind of fields can be created?
SuperfellSuperfell
fieldTypes are declared in the metadata WSDL, its important to note that the metadata API is not a mirror image of the describeSObject API.


<xsd:simpleType name="FieldType">
xsd:restriction base="xsd:string">
<xsd:enumeration value="AutoNumber"/>
<xsd:enumeration value="Lookup"/>
<xsd:enumeration value="MasterDetail"/>
<xsd:enumeration value="Checkbox"/>
<xsd:enumeration value="Currency"/>
<xsd:enumeration value="Date"/>
<xsd:enumeration value="DateTime"/>
<xsd:enumeration value="Email"/>
<xsd:enumeration value="Number"/>
<xsd:enumeration value="Percent"/>
<xsd:enumeration value="Phone"/>
<xsd:enumeration value="Picklist"/>
<xsd:enumeration value="MultiselectPicklist"/>
<xsd:enumeration value="Text"/>
<xsd:enumeration value="TextArea"/>
<xsd:enumeration value="LongTextArea"/>
<xsd:enumeration value="Url"/>
<xsd:enumeration value="EncryptedText"/>
<xsd:enumeration value="Summary"/>
<xsd:enumeration value="Hierarchy"/>
</xsd:restriction>


Message Edited by SimonF on 04-29-2008 07:52 AM
msimondsmsimonds
Thanks Simon!!!   That Answers my question sir, I appreciate it

I should have also looked in the WSDL file, sorry about that
Apex LearnerApex Learner

hi i have been  woring on METADATA Api 

 

and i have successfully create soap envelope to add new picklist value in picklist field

via

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:met="http://soap.sforce.com/2006/04/metadata">
   <soapenv:Header>
      <met:CallOptions>
         <met:client>---</met:client>
      </met:CallOptions>
      <met:SessionHeader>
         <met:sessionId>---</met:sessionId>
      </met:SessionHeader>
   </soapenv:Header>
   <soapenv:Body>
      <update xmlns="http://soap.sforce.com/2006/04/metadata">
     <!--Zero or more repetitions:-->
      <UpdateMetadata xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="customfield">
		    <currentName>lead.number__c</currentName>
		                
		      <metadata xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="CustomField">
		      <!--Optional:-->
		       <fullName>lead.number__c</fullName>
		       <label>number</label>
		    		<picklist>
		              <picklistValues>
		         			<fullName>new</fullName>
		              </picklistValues>
		         		 <sorted>false</sorted>
		  		</picklist>
		         <type>Picklist</type>
		    </metadata>
         </UpdateMetadata>
       </update>
   </soapenv:Body>
</soapenv:Envelope>

 Now issues I am facing , is

Is there any way to update / edit any particular picklist value ???

 

e.g , Object : Lead , field : number__c, type : picklist , picklist values : new , old 

 

any way i can edit "new " to "new_value" via meta data API .

 

Thanks in advance