[SalesForce] Full List of All Accessible Types Through Metadata Api

I am looking for some official Salesforce documentation on a list of all available types in the metadata API. If I am using a package.xml file that looks like:

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>ClassName</members>
        <name>ApexClass</name>
    </types>
    <types>
        <members>TriggerName</members>
        <name>ApexTrigger</name>
    </types>
    <types>
        <members>Custom_Object__c.Custom_Field__c</members>
        <name>CustomField</name>
    </types>
    <types>
        <members>Custom_Object__c-Custom Object Layout</members>
        <name>Layout</name>
    </types>
    <types>
        <members>Custom_Object__c.Custom_Validation</members>
        <name>ValidationRule</name>
    </types>
    <types>
        <members>Custom_Object__c.Custom_Field_Update</members>
        <name>WorkflowFieldUpdate</name>
    </types>
    <types>
        <members>Custom_Object__c.Custom Workflow Rule</members>
        <name>WorkflowRule</name>
    </types>
    <version>27.0</version>
</Package>

So, we have a bunch of different types here and they are all referenced differently. A Workflow uses Object_API_Name__c.Name of workflow rule while a ValidationRule uses uses Object_API_Name__c.Name_of_Field with no __c and a Layout uses Object_API_Name__c-Hyphen Layout. It all seems really random to me and I have been having a difficult time trying to guess how I am supposed to reference each of these. There are other things like accessing custom profiles just by their name but a standard profile like the System Administrator is actually just called Admin. I just don't know how to access all of this.

So, I am looking for anyone who knows of any documentation available to detail two different things:

  • The types available (i.e. ApexClass, ApexTrigger, Layout, WorkflowFieldUpdate, etc)
  • The proper way of pulling those through the members tag (Do I use object name with a hyphen, dot annotation, just the custom field, etc?)

Best Answer

Good question, both these things are not as clear as they should be in the docs. Here are some points that can help you.

Discovering all Metadata Types.

  • This topic in the documentation gives you the top level types. However you will notice that other types such as CustomField or ValidationRule are not listed. This is due to them being child meta types.
    • Which are available as part of the top level ones or individually. The way to determine those via the documetnation and downloading the WSDL is described in this topic.
  • The other option, programically is to call the describeMetadata operation (which is what Eclipse and other tools do).
  • If you want a more interactive experince the Force.com Workbench tool can also give you this list (again using the describeMetadata call as described here).

Discovering Identifiers for Metadata Types

  • The documentation for each metadata type (top level or child) does descrbe the full name in more detail, however the best examples can come from the XML snippets they show below.
  • As above, one of the best options is to browse for it via Force.com Workbench as discussed above. Or indeed let Eclipse generate your package.xml by using its Metadata Project Contents dialog.

Hope this helps!

enter image description here

Related Topic