Before deploying metadata in Sandbox of production, have you felt that how great it would be to generate configuration workbook ? Or compare sandboxes for difference ? Or check if fields are used on any page layouts or not ? Dear reader, you are in need of custom Salesforce DX plugin.
Complete source code is available on my Github repository here.
- Nodejs Installed
- Salesforce DX Installed
First step is to install yarn using below command
sudo npm install -g yarn
Next is to run below command, it will create a plugin Template for Salesforce DX which already has all boilerplate code to connect to Salesforce and query data.
Once plugin created, it’s time to link this plugin with Salesforce DX using below command
sfdx plugins:link foldername #If already in folder then folder name would be blank sfdx plugins:link
Below is the structure of directory
As per above folder structure, I’m running command from DF18DEMO and src is immediate folder which contains plugin code, then below command would be used to link this code with Salesforce DX
To run this plugin, we need to run command
sfdx hello:org -u jit11
Above, jit11 is already approved org using command sfdx force:auth:web:login
Below image shows summary of commands and its results
Download code from here , To run plugin which generates workbook. After downloading, run link command. Below are detail of various command parameters
USAGE $ sfdx DF18:fileoutput OPTIONS -f, --force example boolean flag -m, Comma separated list of objects to be exported. If blank then every object of Org would be exported -p, --path File Name with full Path to create Excel File -u, --targetusername=targetusername username or alias for the target org; overrides default target org -v, --targetdevhubusername=targetdevhubusername username or alias for the dev hub org; overrides default dev hub org --apiversion=apiversion override the api version used for api requests made by this command --json format output as json --loglevel=(trace|debug|info|warn|error|fatal) logging level for this command invocation EXAMPLE Example : sfdx DF18:fileoutput -u jit27 -m "Account,Lead,Opportunity" Jitendras-MBP:sfdx-plugin jitendra.zaaibm.com$ sfdx DF18:fileoutput --help USAGE $ sfdx DF18:fileoutput OPTIONS -f, --force example boolean flag -m, Comma separated list of objects to be exported. If blank then every object of Org would be exported -p, --path File Name with full Path to create Excel File