retrieve Commands
retrieve metadata (Beta)
Description for retrieve metadata
You must run this command from within a project.
If your org allows source tracking, then this command tracks the changes in your source. Some orgs, such as production org, never allow source tracking. You can also use the "--no-track-source" flag when you create a scratch or sandbox org to disable source tracking.
To retrieve multiple metadata components, either use multiple --metadata <name> flags or use a single --metadata flag with multiple names separated by spaces. Enclose names that contain spaces in one set of double quotes. The same syntax applies to --manifest and --source-dir.
Examples for retrieve metadata
Retrieve remote changes:
1sf retrieve metadataRetrieve the source files in a directory:
1sf retrieve metadata --source-dir path/to/sourceRetrieve a specific Apex class and the objects whose source is in a directory (both examples are equivalent):
1sf retrieve metadata --source-dir path/to/apex/classes/MyClass.cls path/to/source/objects1sf retrieve metadata --source-dir path/to/apex/classes/MyClass.cls --source-dir path/to/source/objectsRetrieve all Apex classes:
1sf retrieve metadata --metadata ApexClassRetrieve a specific Apex class:
1sf retrieve metadata --metadata ApexClass:MyApexClassRetrieve all custom objects and Apex classes (both examples are equivalent):
1sf retrieve metadata --metadata CustomObject ApexClass1sf retrieve metadata --metadata CustomObject --metadata ApexClassRetrieve all metadata components listed in a manifest:
1sf retrieve metadata --manifest path/to/package.xmlRetrieve metadata from a package:
1sf retrieve metadata --package-name MyPackageNameRetrieve metadata from multiple packages, one of which has a space in its name (both examples are equivalent):
1sf retrieve metadata --package-name Package1 "PackageName With Spaces" Package31sf retrieve metadata --package-name Package1 --package-name "PackageName With Spaces" --package-name Package3Usage
- sf retrieve metadata
- [--json]
- [-a API-VERSION]
- [-c]
- [-x MANIFEST]
- [-m METADATA]
- [-n PACKAGE-NAME]
- [-d SOURCE-DIR]
- [-o TARGET-ORG]
- [-w WAIT]
Flags
- --json
- Optional
-
Format output as json.
- Type: boolean
- -a | --api-version API-VERSION
- Optional
-
Target API version for the retrieve.
Use this flag to override the default API version, which is the latest version supported the CLI, with the API version in your package.xml file.
- Type: option
- -c | --ignore-conflicts
- Optional
-
Ignore conflicts and retrieve and save files to your local filesystem, even if they overwrite your local changes.
This flag applies only to orgs that allow source tracking. It has no effect on orgs that don't allow it, such as production orgs.
- Type: boolean
- -x | --manifest MANIFEST
- Optional
-
File path for the manifest (package.xml) that specifies the components to retrieve.
If you specify this parameter, don’t specify --metadata or --source-dir.
- Type: option
- -m | --metadata METADATA
- Optional
-
Metadata component names to retrieve.
- Type: option
- -n | --package-name PACKAGE-NAME
- Optional
-
Package names to retrieve.
- Type: option
- -d | --source-dir SOURCE-DIR
- Optional
-
File paths for source to retrieve from the org.
The supplied paths can be to a single file (in which case the operation is applied to only one file) or to a folder (in which case the operation is applied to all source files in the directory and its subdirectories).
- Type: option
- -o | --target-org TARGET-ORG
- Optional
-
Login username or alias for the target org.
Overrides your default org.
- Type: option
- -w | --wait WAIT
- Optional
-
Number of minutes to wait for the command to complete and display results to the terminal window.
If the command continues to run after the wait period, the CLI returns control of the terminal window to you.
- Type: option
- Default value: 33 minutes