Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: prevent empty parent xml overwrites #1308

Merged
merged 8 commits into from
May 10, 2024

Conversation

mshanemc
Copy link
Contributor

What does this PR do?

when retrieving a decomposed type (ex a customField) the API returns the parent (customObject) with only the requested field inside it.
Decomposition removes the requested field from the parent, leaving it empty (a CustomObject with no child xml nodes) and then writes that.

What issues does this PR fix or reference?

forcedotcom/cli#2865
@W-15727064@

repro

have a repo with custom objects in it. (dreamhouse works fine)
sf project retrieve start -m CustomField:Foo__c.Bar__c

before: the object-meta.xml would be blank unless you retrieve the CustomObject, too
after: the object-meta.xml keeps its original values

Note: you can still retrieve a field and end up with an empty parent, as long as you didn't have the parent before. To get the parent's contents, include it in your retrieve (ex: sf project retrieve start -m CustomField:Foo__c.Bar__c -m CustomObject:Foo__c)

@mshanemc mshanemc marked this pull request as ready for review May 10, 2024 16:33
@mshanemc mshanemc requested a review from a team as a code owner May 10, 2024 16:33
@mdonnalley
Copy link
Contributor

QA:

setup

  • checkout branch, yarn && yarn build
  • yarn link @salesforce/source-deploy-retrieve in PDR
  • sf plugins link --no-install in PDR

In dreamhouse-lwc
sf project retrieve start -m CustomField:Broker__c.Broker_Id__c

🟢 force-app/main/default/objects/Broker__c/Broker__c.object-meta.xml is not empty

@mdonnalley mdonnalley merged commit b8a8c7f into main May 10, 2024
68 checks passed
@mdonnalley mdonnalley deleted the sm/prevent-empty-parent-overwrites branch May 10, 2024 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants