function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Corey CummingsCorey Cummings 

sfdx push results in huge list of errors

I have followed the instructions for creating a sfdx project locally and converted all of my metadata to the sfdx format. Now I want to push my local meta data to my scratch org but I receive a huge list of errors. Most of them are that the objects are different and items don't exist, which I know because it's the first time I want to push my local version to the scratch org so my scratch org matches my production/sandbox metadata.Has anyone had this problem and have any advice to how to deploy my local set of metadata to a scratch org? I tried to use the --forceoverwrite parameter on sfdx push, but I still receive a LOT of errors such as invalid type, field does not exist, etc. I would think this command would overwrite what is on the scratch org with what I am pushing to it. Thanks for any advice
Jamie StudzinskiJamie Studzinski
Is the scratch org new or an existing one? Could always try to delete the existing one and creating a new one to push.
Corey CummingsCorey Cummings
This is a new scratch org. I have yet to get this to work, of course my production and sandbox are different than a new scratch org, but I want to update the scratch org using the objects and extended fields from production/sandbox. For each object that is different I receive errors when executing the push command "sfdx force:source:push --targetusername [scratchorgusername] --ignorewarnings --forceoverwrite".
Error examples (too many to post all)
1. Field TMCSPL__r does not exist. Check spelling.
2. In field: relatedList - no CustomField named Policy__c.Review__c found
3.  Invalid type: MultiLevelRelationship__c
4. Variable does not exist: CloneMultiLevelRelationshipList
5. Invalid type: Policy__c
It seems to me like there are conflicts, similar to when you merge changes in source control. My question is how to I create a scratch org that has the same schema and objects I have in production so I can follow a normal SDLC process using source control and testing my changes against my real metadata? I don't want a new scratch org with the default items in it, that is useless since I can't deploy and test my new changes to see how my latest changes work with my existing schema before committing them and pushing them to the sandbox.
 
Pascal Le ClechPascal Le Clech
Hi Corey,

I have exactly the same issues.
  1. Internal errors
  2. Standard picklist values not converted
  3. and a lot of odd errors...
it seems it is not reliable so far. There is no easy process to convert existing org to scratch org and new package management is still tagged Beta and it is really a Beta.
SFDX is ok with brand new projects.
Corey CummingsCorey Cummings
I attended a webinar about salesforce DX hosted by the salesforce dev team. They addresses these concerns by stating that we shouldn't be converting our whole org to one salesforce DX project, and should break it down into modules. I don't think this is realistic to be able to do for most developers who have existing orgs to maintain, who already have ALL of the metadata for one org pulled down using the metadata API. My guess is that the deployment tool is still not fully baked and can't determine what all of the local dependencies are when publishing  a deployment from DX format which is why we see these errors time and time again. If the salesforce dev team can make the tool smart enough to determine dependencies and deploy those items in the correct order then these issues would go away IMO.
jjackson1.391016164401765E12jjackson1.391016164401765E12
I am trying to get started with sfdx development and have the same issue of trying to push my local code to the scratch org.  I have confirmed my scratch org exists (I can see a record for it in my Dev Hub org).  But I created the scratch org before adding a new custom object to my Dev Hub org.  Code I am trying to push references the new custom object but I am getting a ton of errors because it looks like the scratch org doesn't recognize my schema change.  I have been trying to figure out how to sync everything up but no luck yet.  
J. Scott CromieJ. Scott Cromie
It's been quite a while and I'm hoping that SOMEONE has figured out how to migrate an existing org with AppExchange packages and custom code, relationships, etc to get to use the scratch orgs properly.  Sure, you can break up the code into multiple projects, but what if I just want one object to move over to a scratch org.  When I attempt this, and there are several relationships to that one object....the push to a newly minted scratch org is just error riddled.  

SO, the question really is this - What is the actual way to get the current configuration in a production org into a scratch org using sfdx force:source:push?  I have grabbed the metadata from Prod using the force:source:retrieve command (and setting up the package.xml file to do this is a terrible thing to do anyway) and converted, and then TRIED to push and received a ton of errors.

Is there a step-by-step set of instructions or best practice to move this stuff into a scratch org to get started?

Thanks in advance,

Scott
jjackson1.391016164401765E12jjackson1.391016164401765E12
I do all my projects in sandbox now and don't use scratch orgs.  This has greatly improved the VSCode experience for me.  But there is a VSCode plugin called Salesforce Package.xml Generator Extension for VSCode that allows you to add or remove metadata components from your package.xml so you can "refresh" metadata in your project's org.  I don't know if it works with scratch orgs but is worth a try.  Perhaps you might want to look into it.
Suraj Tripathi 47Suraj Tripathi 47
Hi Corey Cummings,
Greetings!

You can simply use push operation for a small amount of data.
But if you want to push a huge list, You have to specify the format of the data as well.
please add --json in your push command, you will be able to push a huge list.

If you find your Solution then mark this as the best answer. 

Thank you!

Regards,
Suraj Tripathi