Salesforce DX does not track some of the changes I make on my scratch org.

How to reproduce a problem:

  1. Create a custom profile -> sfdx force:source:pull
  2. Create a custom object -> sfdx force:source:pull
  3. Delete a custom object -> sfdx force:source:pull
  4. sfdx force:source:status shows no problems

Then an interesting thing might be observed - opening a new scratch org and pushing a source there causes the following error:

PROJECT PATH                            ERROR
─────────────────────────────────────── ────────────────────────────────────────────────
force-app\main\default\profiles\My Custom Profile.profile-meta.xml  In field: field - no CustomObject named Custom_Object__c found

The problem is that in the "My Custom Profile.profile-meta.xml" file there's still a <layoutAssignments>` section which I have to delete manually:

      <layout>Custom_Object__c-Custom Object Layout</layout>

My question is: Can I make SFDX to track these changes somehow?

PS Another thing is that it looks like a bug a bit but I'm just not sure.

Update 11/04/20:

The bug has been fixed on the Winter '20 Patch 7.0

Older Update: I've reported this case and Salesforce Support identified it as a bug:

[Deleting a custom field/object should remove references with force:source:pull][2]
Help to resolve this problem by clicking "This Issue Affects Me".
  • 2
    This isnt really an answer so I will comment but I run into this issue a lot when working with sfdx. It happens whenever I delete a custom field. I have to go through the xml files manually and remove the references and then it seems to work. It only seems to happen to me on delete though. I figure it is a bug. Maybe we should open an issue since it seems to be something that is happening to multiple people. Jan 24, 2018 at 15:37
  • Question: when you say "opening a new scratch org and pulling a source there" do you mean pushing source? Not sure what you'd pull from a newly created scratch org. Jan 24, 2018 at 17:14
  • 3
    @ZackWalton As I said - I wasn't sure about that but since I know it affects more people I've decided to report a bug. Jan 25, 2018 at 9:16
  • @WadeWegner Yup, youre right :) Jan 25, 2018 at 9:17
  • I've updated status of the case Feb 12, 2018 at 11:06


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy