2

I have modified some layouts in a managed package, and would like to retrieve the Metadata for those layouts via the Metadata API. I find that I can retrieve these layouts with the following package.xml syntax (Where NS__ is the managed package namespace prefix and My_Object__c is the object I want the layout for):

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>NS__My_Object__c-NS__My Object Layout</members>
        <name>Layout</name>
    </types>
    <version>32.0</version>
</Package>

This seems to work as expected, and the metadata retrieve call successfully returns the layout. However, I am using MavensMate as an IDE, which uses the listMetadata call to determine the correct names for the metadata components. It seems that the listMetadata call does NOT return the correct name for the layout. Instead, I see something like this:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="http://soap.sforce.com/2006/04/metadata">
<soapenv:Body>
<listMetadataResponse>
    <result>
        <createdById>005000000011111AAA</createdById>
        <createdByName>Some User</createdByName>
        <createdDate>2014-03-06T18:44:12.000Z</createdDate>
        <fileName>layouts/NS__My_Object__c-My Object Layout.layout</fileName>
        <fullName>NS__My_Object__c-My Object Layout</fullName>
        <id>00h000000000000AAA</id>
        <lastModifiedById>005000000011111AAA</lastModifiedById>
        <lastModifiedByName>Some User</lastModifiedByName>
        <lastModifiedDate>2015-01-19T17:35:19.000Z</lastModifiedDate>
        <manageableState>installed</manageableState>
        <namespacePrefix>NS</namespacePrefix>
        <type>Layout</type>
    </result>
</listMetadataResponse>
</soapenv:Body>

Because of this discrepancy in the response format from listMetadata and the required input format for the retrieve call, MavensMate is unable to successfully retrieve these metadata files.

I my opinion, this looks like it's potentially a bug in the response format for listMetadata. I'm wondering if I'm doing something wrong here, or is this somehow an expected behavior of the metadata API (and an issue the tool I'm using should handle)?

Edit: Just tried running listMetadata after adding another layout with the same exact name as the managed layout. Strangely, listMetadata reports the same fileName and fullName for both of these layouts, though it shows one as being in the NS package and one being unpackaged... The retrieve call however expects the packaged layout to be NS__My_Object__c-NS__... versus NS__My_Object__c-... for the custom layout.

Your Answer

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

Browse other questions tagged or ask your own question.