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

sf project retrieve start --metadata 'CustomField:<namespace>__*' doesn't retrieve customfields from standard objects #3052

Open
rmartinez1ffdc opened this issue Oct 11, 2024 · 5 comments
Labels
bug Issue or pull request that identifies or fixes a bug

Comments

@rmartinez1ffdc
Copy link

Expected result

Custom fields with the specified namespace to be retrieved.
Relevant standard object and field directories to be created under the objects folder if they don't exist yet.

E.g:
"project/main/default/objects/Account/fields/mycustomfield__nsp__c.field-meta.xml"

Actual result

"Preparing retrieve request... done
Nothing retrieved"

Additional information

When I try to retrieve the customfields created on standard objects by a managed package, the command
sf project retrieve start --metadata 'CustomField:<namespace>__*'
returns
Nothing retrieved

It forces me to adjust the command to specify the standard object names in this way:

sf project retrieve start --metadata 'CustomField:<standardObjectName>.<namespace>__*'

E.g:
sf project retrieve start --metadata 'CustomField:Account.c2g__*'

That solution is not aligned with the general behaviour of the --metadata flag. The documentation doesn't mention it neither.

Since I'm building a process to retrieve those custom fields (among other metadata) from different org types, with different versions of the packages, I can't really know in advance all the standard objects with custom fields created by the managed package on them.

Running the retrieve command with all the possible standard objects names in the org is possible and works well according to our tests, but it takes around 10 minutes and is an unnecessary overload.

System Information

CLI:
@salesforce/cli/2.61.8 darwin-arm64 node-v21.6.2

Plugin Version:
@oclif/plugin-autocomplete 3.2.5 (core)
@oclif/plugin-commands 4.0.16 (core)
@oclif/plugin-help 6.2.13 (core)
@oclif/plugin-not-found 3.2.22 (core)
@oclif/plugin-plugins 5.4.10 (core)
@oclif/plugin-search 1.2.10 (core)
@oclif/plugin-update 4.5.10 (core)
@oclif/plugin-version 2.2.14 (core)
@oclif/plugin-warn-if-update-available 3.1.18 (core)
@oclif/plugin-which 3.2.15 (core)
@salesforce/cli 2.61.8 (core)
apex 3.5.0 (core)
api 1.2.2 (core)
auth 3.6.65 (core)
data 3.6.8 (core)
deploy-retrieve 3.12.15 (core)
info 3.4.9 (core)
limits 3.3.32 (core)
marketplace 1.2.26 (core)
org 4.6.0 (core)
packaging 2.8.10 (core)
schema 3.3.34 (core)
settings 2.3.23 (core)
sobject 1.4.40 (core)
source 3.5.21 (core)
telemetry 3.6.15 (core)
templates 56.3.21 (core)
trust 3.7.32 (core)
user 3.5.32 (core)
SF ENV. VARS.
SF_AUTOUPDATE_DISABLE,true
SF_DISABLE_AUTOUPDATE,true
SF_UPDATE_INSTRUCTIONS,Use "npm update --global @salesforce/cli" to update npm-based installations.
Windows: false
Shell: zsh
Channel: stable

Diagnostics

✅ pass - salesforcedx plugin isn’t installed
✅ pass - you don't have any linked plugins
✅ pass - [@salesforce/plugin-deploy-retrieve] sourceApiVersion matches apiVersion
✅ pass - [@salesforce/plugin-trust] can ping: https://registry.npmjs.org
✅ pass - [@salesforce/plugin-trust] can ping: https://registry.yarnpkg.com
✅ pass - [@salesforce/plugin-trust] can ping: https://artifactory.dev.financialforce.com/artifactory/api/npm/ffdc-npm
✅ pass - using latest or latest-rc CLI version
✅ pass - can access: https://test.salesforce.com
✅ pass - can access: https://appexchange.salesforce.com/services/data
❌ fail - [@salesforce/plugin-auth] CLI supports v2 crypto
✅ pass - can access: https://developer.salesforce.com/media/salesforce-cli/sf/channels/stable/sf-win32-x64-buildmanifest

@mdonnalley
Copy link
Contributor

@rmartinez1ffdc I think you're right that this needs to be addressed. I'll mark it as a bug

As for a workaround, have you tried `sf project retrieve start --metadata 'CustomField:*'. From my testing locally that will give you all the fields on a standard object:

❯ sf project retrieve start --metadata 'CustomField:Account*'
Retrieving v61.0 metadata from test-xolxqlblsmay@example.com using the v62.0 SOAP API
Preparing retrieve request... Succeeded

Retrieved Source
==============================================================================================================================
| State   Name                      Type        Path
| ─────── ───────────────────────── ─────────── ──────────────────────────────────────────────────────────────────────────────
| Changed Account.AccountNumber     CustomField force-app/main/default/objects/Account/fields/AccountNumber.field-meta.xml
| Changed Account.AccountSource     CustomField force-app/main/default/objects/Account/fields/AccountSource.field-meta.xml
| Changed Account.AnnualRevenue     CustomField force-app/main/default/objects/Account/fields/AnnualRevenue.field-meta.xml
| Changed Account.BillingAddress    CustomField force-app/main/default/objects/Account/fields/BillingAddress.field-meta.xml
| Changed Account.CleanStatus       CustomField force-app/main/default/objects/Account/fields/CleanStatus.field-meta.xml
| Changed Account.DandbCompanyId    CustomField force-app/main/default/objects/Account/fields/DandbCompanyId.field-meta.xml
| Changed Account.Description       CustomField force-app/main/default/objects/Account/fields/Description.field-meta.xml
| Changed Account.DunsNumber        CustomField force-app/main/default/objects/Account/fields/DunsNumber.field-meta.xml
| Changed Account.Fax               CustomField force-app/main/default/objects/Account/fields/Fax.field-meta.xml
| Changed Account.Industry          CustomField force-app/main/default/objects/Account/fields/Industry.field-meta.xml
| Changed Account.Jigsaw            CustomField force-app/main/default/objects/Account/fields/Jigsaw.field-meta.xml
| Changed Account.NaicsCode         CustomField force-app/main/default/objects/Account/fields/NaicsCode.field-meta.xml
| Changed Account.NaicsDesc         CustomField force-app/main/default/objects/Account/fields/NaicsDesc.field-meta.xml
| Changed Account.Name              CustomField force-app/main/default/objects/Account/fields/Name.field-meta.xml
| Changed Account.NumberOfEmployees CustomField force-app/main/default/objects/Account/fields/NumberOfEmployees.field-meta.xml
| Changed Account.OperatingHoursId  CustomField force-app/main/default/objects/Account/fields/OperatingHoursId.field-meta.xml
| Changed Account.OwnerId           CustomField force-app/main/default/objects/Account/fields/OwnerId.field-meta.xml
| Changed Account.Ownership         CustomField force-app/main/default/objects/Account/fields/Ownership.field-meta.xml
| Changed Account.ParentId          CustomField force-app/main/default/objects/Account/fields/ParentId.field-meta.xml
| Changed Account.Phone             CustomField force-app/main/default/objects/Account/fields/Phone.field-meta.xml
| Changed Account.Rating            CustomField force-app/main/default/objects/Account/fields/Rating.field-meta.xml
| Changed Account.ShippingAddress   CustomField force-app/main/default/objects/Account/fields/ShippingAddress.field-meta.xml
| Changed Account.Sic               CustomField force-app/main/default/objects/Account/fields/Sic.field-meta.xml
| Changed Account.SicDesc           CustomField force-app/main/default/objects/Account/fields/SicDesc.field-meta.xml
| Changed Account.Site              CustomField force-app/main/default/objects/Account/fields/Site.field-meta.xml
| Changed Account.TickerSymbol      CustomField force-app/main/default/objects/Account/fields/TickerSymbol.field-meta.xml
| Changed Account.Tier              CustomField force-app/main/default/objects/Account/fields/Tier.field-meta.xml
| Changed Account.Tradestyle        CustomField force-app/main/default/objects/Account/fields/Tradestyle.field-meta.xml
| Changed Account.Type              CustomField force-app/main/default/objects/Account/fields/Type.field-meta.xml
| Changed Account.Website           CustomField force-app/main/default/objects/Account/fields/Website.field-meta.xml
| Changed Account.YearStarted       CustomField force-app/main/default/objects/Account/fields/YearStarted.field-meta.xml

@mdonnalley mdonnalley added the bug Issue or pull request that identifies or fixes a bug label Oct 11, 2024
Copy link

git2gus bot commented Oct 11, 2024

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

@rmartinez1ffdc
Copy link
Author

Hi @mdonnalley
Yes, that would retrieve the custom fields but also any other not related to the namespace we need.

We have applied another workaround by specifying the name of the standard object since for our use case we need to be able to filter what we retrieve by namespace.

Thanks for considering this issue that quickly

@agarciaodeian
Copy link

Hi @mdonnalley,
Do you have an expected date to work on this bug? This is also affecting me and my team. Thanks!

@shballesteroscertinia
Copy link

I am experiencing the same problem, do we have any updates?

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

4 participants