In real time we develop some business requirements in salesforce using configuration, then we need to push these change to Version control such as GitLab/Bit bucket. So we will come to know in how many way we can retrieve these changes from salesforce:
2. [-p SOURCEPATH]
3. [-m METADATA]
To retrieve all Apex classes:
$ sfdx force:source:retrieve -m ApexClass
To retrieve a specific Apex class:
$ sfdx force:source:retrieve -m ApexClass:MyApexClass
To retrieve all custom objects and Apex classes:
$ sfdx force:source:retrieve -m CustomObject,ApexClass
To retrieve all Apex classes and two specific profiles (one of which has a space in its name):
$ sfdx force:source:retrieve -m "ApexClass, Profile:My Profile, Profile: AnotherProfile"
4. [-n PACKAGENAMES]
To retrieve metadata from a package:
$ sfdx force:source:retrieve -n MyPackageName
To retrieve metadata from multiple packages(one of which has a space in its name):
$ sfdx force:source:retrieve -n "Package1, PackageName With Spaces, Package3"
To retrieve all metadata from a package and specific components that aren’t in the package, specify both -n | --packagenames and one other scoping parameter:
$ sfdx force:source:retrieve -n MyPackageName -p path/to/apex/classes
$ sfdx force:source:retrieve -n MyPackageName -m ApexClass:MyApexClass
$ sfdx force:source:retrieve -n MyPackageName -x path/to/package.xml
Note: Name with space will have double quotes example "Package1, PackageName With Spaces, Package3", so use this accordingly.
- source:retrieve
Parameters:
- [-x MANIFEST]
- [-p SOURCEPATH]
- [-m METADATA]
- [-n PACKAGENAMES]
1. [-x MANIFEST]
To retrieve all metadata components listed in a manifest:
$ sfdx force:source:retrieve -x path/to/package.xml
To retrieve the source files in a directory:
$ sfdx force:source:retrieve -p path/to/source
To retrieve a specific Apex class and the objects whose source is in a directory:
$ sfdx force:source:retrieve -p path/to/apex/classes/MyClass.cls,path/to/source/objects
To retrieve source files in a comma-separated list that contains spaces:
$ sfdx force:source:retrieve -p "path/to/objects/MyCustomObject/fields/MyField.field-meta.xml, path/to/apex/classes"
$ sfdx force:source:retrieve -p path/to/source
To retrieve a specific Apex class and the objects whose source is in a directory:
$ sfdx force:source:retrieve -p path/to/apex/classes/MyClass.cls,path/to/source/objects
To retrieve source files in a comma-separated list that contains spaces:
$ sfdx force:source:retrieve -p "path/to/objects/MyCustomObject/fields/MyField.field-meta.xml, path/to/apex/classes"
3. [-m METADATA]
To retrieve all Apex classes:
$ sfdx force:source:retrieve -m ApexClass
To retrieve a specific Apex class:
$ sfdx force:source:retrieve -m ApexClass:MyApexClass
To retrieve all custom objects and Apex classes:
$ sfdx force:source:retrieve -m CustomObject,ApexClass
To retrieve all Apex classes and two specific profiles (one of which has a space in its name):
$ sfdx force:source:retrieve -m "ApexClass, Profile:My Profile, Profile: AnotherProfile"
4. [-n PACKAGENAMES]
To retrieve metadata from a package:
$ sfdx force:source:retrieve -n MyPackageName
To retrieve metadata from multiple packages(one of which has a space in its name):
$ sfdx force:source:retrieve -n "Package1, PackageName With Spaces, Package3"
To retrieve all metadata from a package and specific components that aren’t in the package, specify both -n | --packagenames and one other scoping parameter:
$ sfdx force:source:retrieve -n MyPackageName -p path/to/apex/classes
$ sfdx force:source:retrieve -n MyPackageName -m ApexClass:MyApexClass
$ sfdx force:source:retrieve -n MyPackageName -x path/to/package.xml
Note: Name with space will have double quotes example "Package1, PackageName With Spaces, Package3", so use this accordingly.
Comments
Post a Comment