I'm trying to push my code into a scratch org using SFDX. I keep getting errors which don't make sense -- many of them are saying how a variable doesn't exist and I scan the class to see the variable declaration and scoping is correct for it to be accessible. Many errors about custom objects too.

These are the steps I followed:

1. Pull current code from git repo
2. Create SFDX project and set up source org
3. Create assets/package.xml to retrieve data using the following cmd: 
   sfdx force:source:retrieve --manifest assets/package.xml
4. Created a scratch org and tried pushing code into scratch org

On the push, I received various variable doesn't exist and custom object errors. What am I missing?

  • have you pushed your custom objects into the scratch org? The scratch org will have nothing other than the features activated you set in the configuration file. Sep 4 '20 at 20:47
  • Or to put it another way, does your project include the objects folder with all your custom objects and their fields in it?
    – Phil W
    Sep 5 '20 at 7:10
  • It may be helpful to see the package.xml and maybe one of the error dumps. Usually might be one or a small number of root cause errors, the rest are typically fixed once you fix the root cause error.
    – pchittum
    Sep 6 '20 at 5:16
  • Update - I scanned all my classes and made sure all custom objects were being retrieved. Tried deploying to scratch org again after retrieval - still keep getting errors saying variable does not exist and exceeded the allowed number of fields to track on a given entity. Would a better approach be to retrieve everything from my dev environment? Sep 8 '20 at 23:22

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.