0

I have a developer edition (with devhub enabled) of salesforce and I treid to create the SFDX project using visual code. So far I am able to do following successfully

  • Create a new project with manifest file
  • Authorize the devhub
  • Created default scratch org

Now, when I open the default scratch org for the first time, I can see that it does not have a custom object, apex classes and visual pages in it (which is obvious).

Hence, I need to retrieve all required things from my developer edition (production) into my SFDX project and for that I have tried following commands

sfdx force:source:retrieve -x .\package.xml

and here is my package.xml

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>*</members>
        <name>ApexClass</name>
    </types>
    <types>
        <members>*</members>
        <name>ApexComponent</name>
    </types>
    <types>
        <members>*</members>
        <name>ApexPage</name>
    </types>
    <types>
        <members>*</members>
        <name>ApexTestSuite</name>
    </types>
    <types>
        <members>*</members>
        <name>ApexTrigger</name>
    </types>
    <types>
        <members>*</members>
        <name>AuraDefinitionBundle</name>
    </types>
    <types>
        <members>*</members>
        <name>LightningComponentBundle</name>
    </types>
    <types>
        <members>*</members>
        <name>StaticResource</name>
    </types>
      <types>
        <members>*</members>
        <name>CustomObject</name>
    </types>    
    <version>46.0</version>
</Package>

After sucessfully executing above command I am still not getting my custom objects in my force-app folder automatically. I also tried following commands but still no luck

SFDX : Pull from default scratch org

sfdx force:mdapi:retrieve -r ./mdAPIZip -u YorkvilleDefault -k /package.xml

here is my scratch-def.json file

{
  "orgName": "YorkvilleDefault",
  "edition": "Developer",
  "features": [],
  "settings": {
    "orgPreferenceSettings": {
      "s1DesktopEnabled": true
    }
  }
}

to better understand my issue please refer to my image below

enter image description here

3
  • 1
    Did you set the defaultusername? The default username tells the Salesforce CLI, and subsequently the Salesforce Extensions, which org to perform actions against.
    – Saroj Bera
    Sep 20, 2019 at 9:23
  • @SarojBera yes that was the reason thanks !!!
    – Hunt
    Sep 23, 2019 at 6:05
  • I have posted my comment as an answer to the question. Please mark the answer as accepted for the benefit of others.
    – Saroj Bera
    Sep 23, 2019 at 7:12

1 Answer 1

1

Please check wheather the default username is set as intended. When you run a CLI command that requires an org connection and you don’t specify a username, the command uses the default. The default username tells the Salesforce CLI, and subsequently the Salesforce Extensions, which org to perform actions against.

Please refere to the Salesforce documentation. You can set the default username with the force:config:set command from your project directory

sfdx force:config:set [email protected]

You must log in to answer this question.

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