PETERZSIGMOND.DEV
GitHub

Commands

A collection of shell commands for IT people

Shell >

Salesforce CLI

Generate manifest with all metadata from org

sf project generate manifest -d ./manifest --from-org org
-d: output directory
--from-org: username or alias of the org
-n: name of the manifest to create

Retrieve metadata

sf retrieve metadata -x manifest/package.xml
sf retrieve metadata -m 'ApexClass:Opportunity*'
-x: manifest file
-m: metadata name (* = wildcard)

Deploy metadata

sf deploy metadata -x manifest/package.xml
sf deploy metadata -m 'ApexClass:Opportunity*'
-x: manifest file
-m: metadata name (* = wildcard)

Run tests

sf apex run test -y -c -n ApexTestClass1 -n ApexTestClass2
sf apex run test -y -c -t ApexTestClass.testMethod
-y: synchronous
-c: coverage
-n: apex test class names
-t: test methods