8

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?)
10

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

  • 2
    Awesome! I have never used the Force.com Workbench before but this tool is really nice! – Jesse Altman Feb 21 '13 at 15:31
1

Quick easy cheat would be going to create outbound change set. For validations - select validations and if there are over 100 go to click more at bottom then go to URL and at end of URL string update Row Count so all are included on one page. Save page as HTML. Then open html doc and copy and paste into excel. You can do this for anything....

0

There is an extention in VS Code that generates package.xml file using point and click

Salesforce Package.xml generator for VS Code https://marketplace.visualstudio.com/items?itemName=VignaeshRamA.sfdx-package-xml-generator

enter image description here

Affiliation: I am the developer for this free to use extension

  • Hi Vignaesh, thanks for adding disclosure to your posts! However, even if you disclose your affiliation, your posts can still be considered spam, particularly if you post nothing but self promotion. Please take a moment to read How to not be a spammer. – Adrian Larson May 12 at 14:01
  • 2
    From that article in the help center: Don't talk about your product / website / book / job too much. Folks will read your answers for their ability to solve a specific problem; if you're good at doing that, then they'll find themselves more interested in who you are and what you're working on. If you respond only to questions where the answer can be something you're selling, they'll assume you're just here to sell. – Adrian Larson May 12 at 14:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.