A collection of bash scripts for my daily work with Salesforce. The scripts are basically wrappers around the sf
cli tool from Salesforce.
Caution
These scripts were created to fit my personal needs. They might not fit your needs. They might not work on your machine. They might not work with your project setup.
Set symlinks to ~/bin/
folder with
make
Alternatively symlink to custom folders like this example:
make BINDIR=/usr/local/bin/ COMPLETIONSDIR=/etc/bash_completions.d
The tools depend on the following non-standard CLI tools:
- sf:
npm install -g @salesforce/cli
- jq:
brew install jq
- VisiData:
brew install saulpw/vd/visidata
- daff:
npm install -g daff
- csvtk:
brew install csvtk
- graph-easy:
brew install cpanminus; cpan Graph::Easy
- watchexec-cli:
brew install watchexec
- XMLStarlet:
brew install xmlstarlet
Run --help
or -h
option to get a description of the tool and how to use it.
Export environment valiable DEBUG
to print the underlying call with sf
like
export DEBUG=1
sf-deploy
or
DEBUG=1 sf-deploy
-
sf-data
downloads all data of Salesforce objects as csv files from an org. -
sf-deploy
builds, deploys and publishes a full project or deploys single entities from the git index in watch mode for ease of development. -
sf-inspect
inspect local custom-labels and their translations as well as permissions from profiles and permission-sets in a tabular manner. -
sf-log
creates or updates the debug log for a given debug-log user and streams log to console. -
sf-metadata
downloads all or specific metadata from an org. -
sf-rel
extracts and displays relations of a given object-id to other objects. -
sf-tooldata
downloads all data as csv files from an org using the Tooling API. -
sf-validate
validate a full project against an org and runs unit tests.
sf-data -o org1 -d .data1 -s Account
sf-data -o org2 -d .data2 -s Account
daff --www .data1/Account.csv .data2/Account.csv
To automatically open retrieved data in VisiData without downloading into your local folder, use the -v
option:
sf-data -v Account
Supposed you are interested in the realations of an Account, e.g. 0019O00000Dc70zQAB
, with User, Contact and AccountContactRelation:
sf-data -s Account -s User -s Contact -s AccountContactRelation
cd .data
sf-rel 0019O00000Dc70zQAB
Only deploying the files you are working on is way faster that always deploying the full project.
File changes are detected automatically and deployed on change in watch-mode for ease of development.
sf-deploy