Thursday, November 15, 2018

SFDX Utility - Easy to use Command Line Wizard

As you would already know, SFDX is Salesforce utility for improved build management and development activities. It is definitely a big leap in terms of bringing Salesforce development practices in line with common delivery and development processes.

However, I believe non-admins, new developers and most of folks who love browser based development will be puzzled, as they now have to move to a not-so-good-looking command line screen to run their commands. Not to mention, they need to remember these commands and all their options.

Who is it for?

This utility (currently) caters to teams/ developers who are yet not using scratch org for their development. I consider you are familiar with managing package.xml to ensure you have your build manifest ready.

What is the need?


  1. Eases pain of entering common development commands (retrieve, deploy, build)
  2. With one time config, you'll be sure you are not messing up with instances
  3. Ensure you or your team follows same process


What does it do?

  1. Retrieve - it performs following steps for each retrieve cycle
    • retrieves components, as per src/package.xml file
    • unzips zip file generated by SFDX
    • copies downloaded components to src folder
    • deletes temporary files
  2. Deploy - allows user to specify username for instance
  3. Test Build - runs a quick validation deployment on a pre-defined build environment/ sandbox

Technical Details

This utility is a windows batch script and tested only on Windows 10, but should work on older windows machines as well (unless you are still using windows 95).

This is a command line utility available for:
  1. Windows machines (tested on Windows 10) - use ctksfdx.bat
  2. *Nix machines (tested on Linux Mint 18.02) - use ctksfdx.sh

Setup

Follow these instructions for each client/ project setup, and you'll not have to enter long SFDX commands again and again.

Setup

(This setup is to be repeated for each client/project)
  1. Copy utility within project folder (https://github.com/CynoteckLabs/SFUtilities/tree/master/CTKSFDX)
  2. Setup configurations within utility (explained below)

Example folder structure



Configure utility

Within configuration section of utility (batch file) setup following:
  1. DEV - define username of development sandbox (line no. 13)
    SET DEV=
  2. BUILD - define username of build test sandbox (line no. 16)
    SET BUILD=

Optional settings:
  1. Retrieve wait period - setup time interval in minutes, utility should wait for retrieve operations to complete
  2. Deploy wait period - setup time interval in minutes, utility should wait for deploy/ built test operations to complete

How to use it?

Remember, this is to reduce complexity and effort for repititive tasks, so all you have to do is fire command ctksfdx

That's it!! 

Utility will give you options to choose.

Remember, to keep it really simple and safe, deploy option needs you to provide username of the org where you want to deploy.

[Update Nov 21, 2018] Added shell script utility for *nix systems.

Popular Posts