Metadata XML Examples (Magic xpi 4.5)
This topic describes the metadata XML files that are used with the Salesforce connector's Metadata CRUD method.
The following block creates a pick list with two values (a2,a3) called pick1, in a custom object called MyObj.
<metadata xsi:type="ns1:CustomField">
<fullName>MyObj__c.pick1__c</fullName>
<label>pick111</label>
<type>Picklist</type>
<picklist>
<sorted>True</sorted>
<picklistValues>
<currentName>a2</currentName>
<fullName>a22</fullName>
</picklistValues>
<picklistValues>
<currentName>a3</currentName>
<fullName>a33</fullName>
</picklistValues>
</picklist>
</metadata>
The following block updates the description of two of an Account object's custom fields.
<metadata xsi:type="ns1:CustomField">
<length>100</length>
<fullName>Account.Text1__c</fullName>
<label>Account.Text1__c</label>label>
<description>Desc modified by Update</description>
<type>Text</type>
</metadata>
<metadata xsi:type="ns1:CustomField">
<length>100</length>
<fullName>Account.Text2__c</fullName>
<label>Account.Text2__c</label>label>
<description>Desc modified by Update</description>
<type>Text</type>
</metadata>
The following block deletes an Account object's custom field.
<ns1:type>CustomField</ns1:type>
<ns1:fullName>Account.Text1__c</ns1:fullName>
The following block upserts two custom fields to an Account object.
<metadata xsi:type="ns1:CustomField">
<fullName>Account.Text1__c</fullName>
<length>100</length>
<label>Account.Text1__c</label>label>
<description>Upsert deleted data Metadata API</description>
<type>Text</type>
</metadata>
<metadata xsi:type="ns1:CustomField">
<fullName>Account.Text2__c</fullName>
<length>100</length>
<label>Account.Text2__c</label>label>
<description>Upsert existing data Metadata API</description>
<type>Text</type>
</metadata>
Note:
|
The metadata BLOB that you need to supply in the CRUD call is not necessarily a legal XML structure, since several sibling Metadata or UpdateMetadata blocks can reside side by side with no wrapping parent.
|