5

Is there a list of Metadata types to the src folder structure (folder names)?

For example in package.xml Apex Classes are

<Name>ApexClass</Name>

But are actually found in the directory

src/classes/

The documentation list all the Package.xml type names, but I don't see any documentation of the folder structure?

6

Use the describeMetadata call to learn the folder names of each of the types. A Java sample is included:

public void describeMetadata() {
  try {
    double apiVersion = 21.0;
    // Assuming that the SOAP binding has already been established.
    DescribeMetadataResult res =
        metadataConnection.describeMetadata(apiVersion);
    StringBuffer sb = new StringBuffer();
    if (res != null && res.getMetadataObjects().length > 0) {
      for (DescribeMetadataObject obj : res.getMetadataObjects()) {
        sb.append("***************************************************\n");
        sb.append("XMLName: " + obj.getXmlName() + "\n");
        sb.append("DirName: " + obj.getDirectoryName() + "\n");
        sb.append("Suffix: " + obj.getSuffix() + "\n");
        sb.append("***************************************************\n");
      }
    } else {
      sb.append("Failed to obtain metadata types.");
    }
    System.out.println(sb.toString());
  } catch (ConnectionException ce) {
    ce.printStackTrace();
  }
}

The Migration Toolkit includes a describeMetadata task that essentially uses this same code.

The documentation only describes the folder names in each element. For example, starting from Metadata Types, you can click on ApexClass, which tells us:

Declarative Metadata File Suffix and Directory Location

The file suffix is .cls for the class file. The accompanying metadata file is named ClassName-meta.xml.

Apex classes are stored in the classes folder in the corresponding package directory.

  • I would say the "just find them in the documentation" bit is the bigger revelation here. – Adrian Larson Sep 9 '16 at 13:34
  • @sfdcfox That will only get the Metadata of active features in an org. IE since I don't have Live Agent in my org (yet) the Live Agent Metadata types are not returned. Ideally I would like a map of every metadata type listed in the documentation. – Stephen Sep 9 '16 at 13:35
  • Wew, I completely missed that the folder is listed in the Metadata Type details screen. To bad it's not in a consistent format. For example "LiveAgentSettings values are stored in the LiveAgent.settings file in the settings directory" as opposed to "Apex classes are stored in the classes folder" – Stephen Sep 9 '16 at 13:38
  • @Stephen I mentioned both ways because either might be applicable. For example, if you're creating a tool that works with metadata, like the Force.com IDE, being able to describe all the elements makes sense. Contrariwise, if you need everything, the documentation is where you need to go. I think the real crime is they don't have a page that lists each type, the folder, and the file extension/metadata file extension. – sfdcfox Sep 9 '16 at 13:40
  • @sfdcfox Yeah, ideally that is what I would be able to get from them. I'll have to compile myself. Thanks. – Stephen Sep 9 '16 at 13:45
4

Of those I use most commonly:

type                path
ApexClass           /src/classes
ApexComponent       /src/components
ApexPage            /src/pages
ApexTrigger         /src/triggers
CustomLabel         /src/labels
StaticResource      /src/staticresources

The rest can be found in the documentation, as noted by @sfdcfox.

  • 1
    Just use the migration toolkit to get the list. – sfdcfox Sep 9 '16 at 13:22

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.