7

I know how to retrieve the Metadata via this questions; Metadata - Case Search Layout

And I understand that they must be retrieved via the Object or Custom Object itself and the list of components editable via the Metadata API can be found here: https://www.salesforce.com/us/developer/docs/api_meta/Content/meta_types_list.htm

It's getting quite thorough!

I am having difficulty, though, finding some examples on how to deploy Search Layout-specific syntax via Force.come IDE or ANT Migration Tool. Here you'll see the field labels are a bit different and then there's the actual deployment process.

Do you need to deploy the entire object with all parameters each time? Or can you just deploy the Object with only the changed Search layouts referenced?

Update It should be noted that the syntax for Search Layout is NOT the same as the API name. For ease of time, it's best to retrieve the objects using Force.com IDE or ANT and adjust then deploy.

1
  • Yea I want to know this too, and also the same question for the "RecordType" section of the Custom Object, the one containing picklist field values per record type. Can't deploy it either. Commented Jul 9, 2015 at 19:52

2 Answers 2

10

To deploy a Search Layout, you must deploy the CustomObject itself. All not-required tags can be stripped, but there is no way to simply deploy a search layout without the object.

This means you'd need something like this:

package.xml:

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
  <types>
    <members>Account</members>
    <name>CustomObject</name>
  </types>
  <version>35.0</version>
</Package>

objects/Account.object:

<?xml version="1.0" encoding="UTF-8"?>
<CustomObject xmlns="http://soap.sforce.com/2006/04/metadata">
    <enableEnhancedLookup>true</enableEnhancedLookup>
    <enableFeeds>true</enableFeeds>
    <enableHistory>false</enableHistory>
    <searchLayouts>
       <!-- as per description in the documentation -->
    </searchLayouts>
    <sharingModel>Private</sharingModel>
</CustomObject>
5
  • Hi Charles, thank you for responding. I'll be getting to this shortly, but i'll circle back once i do and confirm. Thanks! Commented Jan 20, 2016 at 21:18
  • Hi Charles, Thanks! I was able to get this working just fine. The only issue I'm running into is that for custom objects on a managed package, i keep running into errors. Any thoughts? Commented Feb 23, 2016 at 19:01
  • @RyanBerens No clue. What errors? Commented Feb 23, 2016 at 19:04
  • I couldn't deploy the custom object with a sharing rule of Controlled by Parent without providing the Master-Detail fields; however, when i included them it shot off an error stating that I couldn't add new fields. It may be that included too many attributes - really, i'm looking for the minimum i need. And then the other issue: i used teh full API name of a custom field in my searchlayout; and yet it's telling me it doesn't exist. ? Just a few things. Commented Feb 23, 2016 at 19:24
  • @RyanBerens Not sure. I don't deal much with managed packages. It may have something to do with whether or not you include a namespace. Commented Feb 23, 2016 at 19:37
0

Additionally, for profile related search layouts, you need to look for <profileSearchLayouts> tags within the object. This is because <searchLayouts> tag only mentions fields so how do you link profiles with specific fields? Hence the profile tag.

</searchLayouts>
    <searchResultsAdditionalFields>OWNER.FIRST_NAME</searchResultsAdditionalFields>
    <searchResultsAdditionalFields>Creation_Date__c</searchResultsAdditionalFields>
</searchLayouts>
<profileSearchLayouts>
    <fields>NAME</fields>
    <fields>RECORDTYPE</fields>
    <fields>Custom__Status__c</fields>
    <fields>OWNER.FIRST_NAME</fields>
    <profileName>Custom Sales Profile</profileName>
</profileSearchLayouts>

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .