function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Carl BussemaCarl Bussema 

Metadata API retrieves incomplete data for Search Layout with Custom Fields

This has been reported ( before ( in different ways, I expect these two reports are symptoms of the same problem, namely that search layouts do not retrieve and/or deploy correctly using metadata API when they include custom fields and/or buttons.


  1. Add a custom field to Product2 (enable FLS for all profiles to rule that out).
  2. Customize the Price Book Entry default search layout to include that new field
  3. Retrieve the Price Book Entry object using Metadata API
  4. Observe the search layout contains a nil field instead of the custom field.
Here's an example from our org, with 2 custom fields. 
        <searchResultsAdditionalFields xsi:nil="true"/>
        <searchResultsAdditionalFields xsi:nil="true"/>
This makes it impossible to deploy the search layout customization, and it must be recreated by hand in each environment.
Carl BussemaCarl Bussema
I did a little more digging, and it may be that this only effects special layouts like PricebookEntry, where all the fields are cross-object. I tested with a custom object and even a cross-object formula works fine, and a standard object's custom field is fine too, it just happens on PricebookEntry.
Hello Carl,

Did you find a way to deploy for PriceBookEntry too ?

Carl BussemaCarl Bussema
We had admins hand-create/modify the layout in each environment. It was the only workaround we could find.
The bug apparently was fixed behind the scene by Salesforce.
I succeded to deploy it.