Metadata XML Examples (Magic xpi 3.x)
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 above pick list with two new pick list values. In this example, UpdateMetadata blocks are used, and not Metadata blocks as in the case of the Create or Delete calls.
<ns1:UpdateMetadata>
<ns1:currentName>MyObj__c.pick1__c</ns1:currentName>
<metadata xsi:type="ns1:CustomField">
<fullName>MyObj__c.pick1__c</fullName>
<label>pick111</label>
<type>Picklist</type>
<picklist>
<sorted>True</sorted>
<picklistValues>
<currentName>a44</currentName>
<fullName>a4</fullName>
</picklistValues>
<picklistValues>
<currentName>a55</currentName>
<fullName>a5</fullName>
</picklistValues>
</picklist>
</metadata>
</ns1:UpdateMetadata>
The following block deletes the above pick list. You need to supply the name of the pick list that you want to delete.
<metadata xsi:type="ns1:CustomField">
<fullName>MyObj__c.pick1__c</fullName>
</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.
|