2

I'm trying to get everything set up with SFDX to deploy to scratch orgs. I've gotten all my metadata from a sandbox and prepared it so that it deploys to a new scratch orgs without problems using the following command:

sfdx force:source:deploy -p "./Default-Package"

There are no errors or anything.

But when I create a new scratch org and try and deploy using:

sfdx force:source:push

I get an error for every custom object saying:

Must specify a non-empty label for the CustomObject

For several of the standard objects, I get the error (For example Survey.object):

Custom Object Definition ID: bad value for restricted picklist field: Survey

The strange thing is, that all the object files appear to have a label xml component:

<?xml version="1.0" encoding="UTF-8"?>
<CustomObject xmlns="http://soap.sforce.com/2006/04/metadata">
    <customSettingsType>Hierarchy</customSettingsType>
    <description>Settings related to a Host&apos;s Availability</description>
    <enableFeeds>false</enableFeeds>
    <fields>
        <fullName>Max_Days_Availability_Not_Updated__c</fullName>
        <description>The number of days a host can go between updating their availability before the portal requires an update.</description>
        <externalId>false</externalId>
        <inlineHelpText>The number of days a host can go between updating their availability before the portal requires an update.</inlineHelpText>
        <label>Max Days Availability Not Updated</label>
        <precision>3</precision>
        <required>false</required>
        <scale>0</scale>
        <trackTrending>false</trackTrending>
        <type>Number</type>
        <unique>false</unique>
    </fields>
    <label>Host Availability Settings</label>
    <visibility>Public</visibility>
</CustomObject>

but it didn't seem to help. Any advice on what to do? Also, deploying first and then trying to push also doesn't work.

Here is my sfdx-project.json if it helps:

{
  "packageDirectories" : [
    { "path": "./Default-Package", "default": true}

  ],
  "namespace": "",
  "sfdcLoginUrl" : "https://login.salesforce.com",
  "sourceApiVersion": "53.0"
}

1 Answer 1

2

Your metadata file is not in the correct format. Use force:mdapi:convert to get it in to the correct format.

sfdx force:mdapi:convert -r path/to/metadata -d path/to/outputdir

I'm actually kind of surprised force:source:deploy works here, because your metadata is in the wrong format. The CustomObject you've posted here is the older "mdapi" format, while the newer "source" format separates fields, validation rules, etc into separate objects and folders.

You must log in to answer this question.

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