I am trying to use force:mdapi:retrieve with force:madpi:deploy to move some sandbox dev org custom objects and supporting customisations to a scratch org, in order to be able to subsequently push a source code package. I am fetching and deploying a subset of the custom objects via mdapi so that my scratch org has all the necessary custom objects used by Apex controller code (SOQL statements etc) in my source code project. In my manifest for the mdapi:retrieve and mdapi:deploy I specify all the custom objects and custom fields we seem to need and I've also added,


Is there something I need to include in my manifest to avoid the error I am seeing when I try and deploy my unpackaged.zip to my scratch org: "Error unpackaged/objects/Policy__c.object Policy__c Profile Search Layout: - System Administrator - not appropriate for object 01I7E0000017CS5"

The sandbox dev org I am fetching metadata from includes a search layout assigned to the system administrator profile - with 3 fields specified for the search layout, 2 of which are custom fields and the other is the standard name field. The custom object file definition - fetched by force:mdapi:retrieve mentions these bits, that i assume are the relevant parts,

        <profileName>System Administrator</profileName>


  • when you say deploy to scratch are you doing a force:source:push? – edralph Jul 21 at 9:58
  • @edralph, I'm doing 2 things: firstly retrieving custom objects from a sandbox org, to deploy to a scratch org where i am developing code. I am doing this first part with force:mdapi:retrieve and force:madpi:deploy. Secondly I want to push an LWC source code project - using force:source:push - into this scratch org. If i do not do the first part, the Apex controller classes in my LWC fail to compile on push to the scratch org because the controllers depend on those custom objects. Hope that makes sense. – josephh Jul 23 at 14:53
  • Hard to troubleshoot without being able to poke about - but can you create the custom objects in your scratch org then pull into source? Then push. – edralph Jul 24 at 10:00

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.