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

Retrieving CustomFields causes empty CustomObject to be retrieved #2865

Open
mdonnalley opened this issue May 9, 2024 · 10 comments
Open

Retrieving CustomFields causes empty CustomObject to be retrieved #2865

mdonnalley opened this issue May 9, 2024 · 10 comments
Labels
bug Issue or pull request that identifies or fixes a bug

Comments

@mdonnalley
Copy link
Contributor

Summary

(NOTE: created from internal slack thread)

With 2.36.8 or later, I am observing that even though I am trying to retrieve a customField, the CLI fetches the Object-meta.xml file as well and its overwriting the existing Object-meta.xml file by removing all the content of it and making it blank(and even though the file exists the state of the file is always fetched as created for object-meta.xml)

sf project retrieve start -m CustomField:Account_Plan__c.Products_Services__c -o qa

Retrieving v59.0 metadata from sgupta3@salesforce.com.artlr1qa1 using the v60.0 SOAP API
Preparing retrieve request... Succeeded

Retrieved Source
=====================================================================================================================================================
| State   Name                                 Type         Path                                                                                      
| ─────── ──────────────────────────────────── ──────────── ───────────────────────────────────────────────────────────────────────────────────────── 
| Changed Account_Plan__c.Products_Services__c CustomField  force-app/main/default/objects/Account_Plan__c/fields/Products_Services__c.field-meta.xml 
| Created Account_Plan__c                      CustomObject force-app/main/default/objects/Account_Plan__c/Account_Plan__c.object-meta.xml  
git diff force-app/main/default/objects/Account_Plan__c/Account_Plan__c.object-meta.xml
diff --git a/force-app/main/default/objects/Account_Plan__c/Account_Plan__c.object-meta.xml b/force-app/main/default/objects/Account_Plan__c/Account_Plan__c.object-meta.xml
index d175c1808..d254e9b03 100644
--- a/force-app/main/default/objects/Account_Plan__c/Account_Plan__c.object-meta.xml
+++ b/force-app/main/default/objects/Account_Plan__c/Account_Plan__c.object-meta.xml
@@ -1,173 +1,2 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<CustomObject xmlns="http://soap.sforce.com/2006/04/metadata">
-    <actionOverrides>
-        <actionName>Accept</actionName>
-        <type>Default</type>
-    </actionOverrides>
-    <actionOverrides>
-        <actionName>Accept</actionName>
-        <formFactor>Large</formFactor>
-        <type>Default</type>
-    </actionOverrides>
-    <actionOverrides>
-        <actionName>Accept</actionName>
-        <formFactor>Small</formFactor>
-        <type>Default</type>
-    </actionOverrides>
-    <actionOverrides>
-        <actionName>CancelEdit</actionName>
-        <type>Default</type>
-    </actionOverrides>
-    <actionOverrides>
-        <actionName>CancelEdit</actionName>
-        <formFactor>Large</formFactor>
-        <type>Default</type>
-    </actionOverrides>
-    <actionOverrides>
-        <actionName>CancelEdit</actionName>
-        <formFactor>Small</formFactor>
-        <type>Default</type>
-    </actionOverrides>
-    <actionOverrides>
-        <actionName>Clone</actionName>
-        <type>Default</type>
-    </actionOverrides>
-    <actionOverrides>

Expected result

Expected force-app/main/default/objects/Account_Plan__c/Account_Plan__c.object-meta.xml to not be empty

Actual result

force-app/main/default/objects/Account_Plan__c/Account_Plan__c.object-meta.xml is empty

System Information

{
  "architecture": "darwin-x64",
  "cliVersion": "@salesforce/cli/2.39.6",
  "nodeVersion": "node-v21.7.1",
  "osVersion": "Darwin 23.4.0",
  "rootPath": "/usr/local/lib/node_modules/@salesforce/cli",
  "shell": "zsh",
  "pluginVersions": [
    "@oclif/plugin-autocomplete 3.0.16 (core)",
    "@oclif/plugin-commands 3.3.1 (core)",
    "@oclif/plugin-help 6.0.21 (core)",
    "@oclif/plugin-not-found 3.1.6 (core)",
    "@oclif/plugin-plugins 5.0.14 (core)",
    "@oclif/plugin-search 1.0.23 (core)",
    "@oclif/plugin-update 4.2.7 (core)",
    "@oclif/plugin-version 2.0.17 (core)",
    "@oclif/plugin-warn-if-update-available 3.0.15 (core)",
    "@oclif/plugin-which 3.1.8 (core)",
    "@salesforce/cli 2.39.6 (core)",
    "apex 3.1.9 (core)",
    "auth 3.6.3 (core)",
    "custom-metadata 3.1.16 (user)",
    "data 3.3.2 (core)",
    "deploy-retrieve 3.6.6 (core)",
    "info 3.2.3 (core)",
    "limits 3.3.4 (core)",
    "marketplace 1.2.4 (core)",
    "org 4.1.3 (core)",
    "packaging 1.26.4 (user)",
    "schema 3.3.4 (core)",
    "settings 2.2.1 (core)",
    "sobject 1.3.6 (core)",
    "source 3.3.3 (core)",
    "telemetry 3.3.4 (core)",
    "templates 56.2.4 (core)",
    "trust 3.6.6 (core)",
    "user 3.5.2 (core)",
    "@salesforce/sfdx-scanner 3.15.0 (user)",
    "sfdmu 4.30.0 (user)",
    "sfdx-git-delta 5.38.2 (user)",
    "vlocityestools 0.24.5 (user)"
  ]
}

Additional Information

Last working version was 2.35.6

Workaround: retrieve the object at the same time you're retrieving the field, or just retrieve the whole object instead of a single field

@mdonnalley mdonnalley added investigating We're actively investigating this issue bug Issue or pull request that identifies or fixes a bug and removed investigating We're actively investigating this issue labels May 9, 2024
Copy link

github-actions bot commented May 9, 2024

Thank you for filing this issue. We appreciate your feedback and will review the issue as soon as possible. Remember, however, that GitHub isn't a mechanism for receiving support under any agreement or SLA. If you require immediate assistance, contact Salesforce Customer Support.

Copy link

github-actions bot commented May 9, 2024

Hello @mdonnalley 👋 None of the versions of sf you shared match the latest release.

Shared: 2.39.6
Latest: 2.40.7

Update to the latest version of Salesforce CLI (docs) and confirm that you're still seeing your issue.
You can also try the rc and nightly releases! (docs)

After updating, share the full output of sf version --verbose --json

@github-actions github-actions bot added the more information required Issue requires more information or a response from the customer label May 9, 2024
Copy link

git2gus bot commented May 9, 2024

This issue has been linked to a new work item: W-15727064

@mdonnalley mdonnalley removed the more information required Issue requires more information or a response from the customer label May 9, 2024
@mdonnalley
Copy link
Contributor Author

mdonnalley commented May 10, 2024

latest-rc (2.41.8) has been patched to include the fix for this

@jshackell-sfdc
Copy link
Collaborator

This issue is fixed in version 2.41.8 -- enjoy!

@Goobles
Copy link

Goobles commented May 28, 2024

This issue still exists in 2.42.6
I do not enjoy 😞

@iowillhoit iowillhoit reopened this May 28, 2024
@aheber
Copy link

aheber commented May 28, 2024

@shabu74, disclaimer, I'm not a maintainer and not an employee of Salesforce. Just another person who depends on these tools for their daily work.

Your words come across hurtful. If that wasn't your intention I hope you can appreciate how I see them. I can personally attest to the level of care that this team has for their product.

If you feel this isn't going well enough for you then please get involved and find a way to contribute. Testing, code fixes, whatever you think would help get a solution delivered faster.

It is wonderful that this is an open source project and is very special that we have such direct access to the developers and team. Please be respectful, I would be very sad if this team became less available due to poor public interactions. Please remember that your words are read by humans and can have a real impact, positive or negative.

@Goobles
Copy link

Goobles commented May 28, 2024

Unproductive comments aside, I installed version 2.41.8 and retried by creating only a field on a custom SObject. The same behavior still happens on that version for me:

Creating just a new field on the Absence__c object in my example, causes the Object xml to be emptied completely:

image

All the other changes work as expected:
image
I am running the CLI version that was mentioned earlier claiming to fix the issue:

{
  "architecture": "darwin-arm64",
  "cliVersion": "@salesforce/cli/2.41.8",
  "nodeVersion": "node-v20.12.2",
  "osVersion": "Darwin 23.4.0",
  "rootPath": "/Users/gobiusdolhain/.local/share/sf/client/2.41.8-dd2c629",
  "shell": "zsh",
  "pluginVersions": [
    "@oclif/plugin-autocomplete 3.0.17 (core)",
    "@oclif/plugin-commands 3.3.2 (core)",
    "@oclif/plugin-help 6.0.21 (core)",
    "@oclif/plugin-not-found 3.1.8 (core)",
    "@oclif/plugin-plugins 5.0.19 (core)",
    "@oclif/plugin-search 1.0.23 (core)",
    "@oclif/plugin-update 4.2.11 (core)",
    "@oclif/plugin-version 2.0.18 (core)",
    "@oclif/plugin-warn-if-update-available 3.0.16 (core)",
    "@oclif/plugin-which 3.1.9 (core)",
    "@salesforce/cli 2.41.8 (core)",
    "apex 3.1.11 (core)",
    "auth 3.6.9 (core)",
    "data 3.3.4 (core)",
    "deploy-retrieve 3.6.13 (core)",
    "info 3.2.7 (core)",
    "limits 3.3.5 (core)",
    "marketplace 1.2.5 (core)",
    "org 4.1.8 (core)",
    "packaging 2.4.2 (core)",
    "schema 3.3.6 (core)",
    "settings 2.2.6 (core)",
    "signups 2.3.1 (user)",
    "sobject 1.4.1 (core)",
    "source 3.3.9 (core)",
    "telemetry 3.3.5 (core)",
    "templates 56.2.5 (core)",
    "trust 3.6.8 (core)",
    "user 3.5.5 (core)"
  ]
}

The same behavior happens on the latest version (2.42.6) as well

PS:

I am using source tracking, so the command I am (or rather Illuminated cloud is) using is sf project retrieve start and not a retrieve with a specific field name

@Goobles
Copy link

Goobles commented May 29, 2024

I can confirm that it does however work correctly in version 2.35.6 on my setup

@shabu74
Copy link

shabu74 commented May 29, 2024

Extremely sorry for my words @aheber. I was that much frustrated with the nightmares related to this CLI release changes. When release note says that 'fixed one', something always started to break. That led to the wastage of lot of time during our deployment. Again, I apologize for my words. I assure it won't happen again. Highly appreciated your patient and sensible reply!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue or pull request that identifies or fixes a bug
Projects
None yet
Development

No branches or pull requests

6 participants