I have a custom object. In the new scratch org I changed a custom button URL of the object using Salesforce UI. Then I run sfdx force:source:pull
and retrieved 2 changed files: the changed weblink and the object's xml. Weblink file is fine but the object xml file is broken as it's content vanished.
My <ObjectApiName>.object-meta.xml
before the pull:
<?xml version="1.0" encoding="UTF-8"?>
<CustomObject xmlns="http://soap.sforce.com/2006/04/metadata">
<actionOverrides>
<actionName>Accept</actionName>
<type>Default</type>
</actionOverrides>
...
...
<sharingModel>ReadWrite</sharingModel>
<visibility>Public</visibility>
</CustomObject>
after:
<?xml version="1.0" encoding="UTF-8"?>
<CustomObject xmlns="http://soap.sforce.com/2006/04/metadata">
<enableEnhancedLookup>true</enableEnhancedLookup>
</CustomObject>
Why it happened and how to make it preserve the object's xml?
source:pull
command if you can replicate it consistently. For instance, there's some open issues about using source:pull after creating new objects and pulling the dependent metadata changes on profiles and layouts. I'd have to test on my end if the same occurs for your given scenario