I'm trying to deploy a PricebookEntry object containing a SearchLayout which contains standard and custom fields however I'm having issues when I include a custom field.
The following is what happens:
If I add the custom field to the search layout through the UI and I retrieve the metadata using the Force.com migration toolkit the searchLayout contains the following.
<searchLayouts>
<searchResultsAdditionalFields>PRODUCT.NAME</searchResultsAdditionalFields>
<searchResultsAdditionalFields xsi:nil="true"/>
<searchResultsAdditionalFields>PRODUCT.DEFAULT_PRICE</searchResultsAdditionalFields>
<searchResultsAdditionalFields>PRODUCT.CUSTOMER_PRODUCT_ID</searchResultsAdditionalFields>
<searchResultsAdditionalFields>PRODUCT2.FAMILY_ENUM</searchResultsAdditionalFields>
</searchLayouts>
In this is at the position where I added the custom field to the searchLayout through the UI. If I deploy the same metadata back to the org it removes the custom field from the search layout. I've tried therefore to change the metadata as follows to add the custom field directly.
<searchResultsAdditionalFields>PRODUCT2.Manufacturer__c</searchResultsAdditionalFields>
but the following error is returned
- objects/PricebookEntry.object -- Error: In field: searchResultsFields - no CustomField named PricebookEntry.PRODUCT2.Manufacturer__c found
The Manufacturer__c field does exists on product2 though. Does anyone know how custom fields can be added to the search layout for deployment?
I noticed the following related post How do you deploy edited Search Layouts via Metadata API using ANT or Force.com IDE? but it does not provide a solution.