3

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?

2
  • 1
    This could be a issue with the 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 Mar 12, 2020 at 12:48
  • I know this is a year old but I also had this issue. I found a solution was to make some change in the UI to something like the search layout for the object, then when I pulled all the data came back into the object. It seems that some changes to the object cause the metadata to vanish and some will bring it back Mar 12, 2021 at 9:34

1 Answer 1

1

As far with the tests I made the org just pulls the changes you did or the metadatas you explicity put in the package.

If you want to get everything whithin the Object you should get all CustomFields, all Actions, etc. and the Object you want, for example.

<types>
    <members>*</members>
    <name>CustomField</name>
</types>
<types>
    <members>MyCustomObject__c</members>
    <name>CustomObject</name>
</types>
2
  • Hello @Luis, is it a package.xml file? How can I use it with the force:source:pull command? Mar 12, 2020 at 11:15
  • 2
    @MikhailIvanov I use the following command sfdx force:source:retrieve --manifest C:\FolderName\myManifest.xml Mar 12, 2020 at 13:22

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.