forcedotcom / forcedotcom/cli

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

Open
#3,052 6 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
No language data
Stars
571
Forks
80
Avg merge
2d 15h
Merged PRs (30d)
3

Description

### 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:__*'`
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:.__*'`

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](https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/cli_reference_project_commands_unified.htm#cli_reference_project_retrieve_start_unified) 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
:white_check_mark: pass - salesforcedx plugin isn’t installed
:white_check_mark: pass - you don't have any linked plugins
:white_check_mark: pass - [@salesforce/plugin-deploy-retrieve] sourceApiVersion matches apiVersion
:white_check_mark: pass - [@salesforce/plugin-trust] can ping: https://registry.npmjs.org
:white_check_mark: pass - [@salesforce/plugin-trust] can ping: https://registry.yarnpkg.com
:white_check_mark: pass - [@salesforce/plugin-trust] can ping: https://artifactory.dev.financialforce.com/artifactory/api/npm/ffdc-npm
:white_check_mark: pass - using latest or latest-rc CLI version
:white_check_mark: pass - can access: https://test.salesforce.com
:white_check_mark: pass - can access: https://appexchange.salesforce.com/services/data
:x: fail - [@salesforce/plugin-auth] CLI supports v2 crypto
:white_check_mark: pass - can access: https://developer.salesforce.com/media/salesforce-cli/sf/channels/stable/sf-win32-x64-buildmanifest

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.