Koa
The swiss army knife for QTC Engineering.
Koa is a swiss army knife for Salesforce CPQ engineering tasks from the Terminal to improve engineering productivity. The goal is to reduce toil and manual clicking work in the GUI that slows down actual work.
Getting Started
Prerequisites
Disclaimer: Koa works best on macOS and Linux.
- Unix-like operating system (macOS or Linux)
-
git
should be installed -
python
should be installed
Basic Installation
koa is installed by running the following commands in your terminal.
npm install -g @siddhanthm/koa
Using Koa
koa briki
Open the salesforce cpq briki
$ koa briki
koa build
Builds and transpiles the Javascript client-side code with Gulp.js.
$ koa build
Running gulp build...
Run this command with -f
to fix node and bower dependecy issues automatically. This is helpful if you get ERROR: Path is undefined
errors when pushing to scratch orgs.
$ koa build -f
Installing bower dependencies...
Installing npm dependencies...
Running gulp build...
koa clean
Cleans all the merged github branches and expired sfdx orgs
$ koa clean
koa connect
Connects a TeamCity-created scratch org to local SFDX environment, allowing changes to be pushed to those orgs.
$ koa connect
koa console
Koa contains an APEX console that reads each line one at a time and then executes all lines when run
or print
is entered. To start the console, run:
$ koa console -u scratch-org-name
From there APEX commands run them on your scratch org. SOQL commands that start with a "[" will get executed immediately.
[511] > [SELECT Id FROM Product2]
(Product2:{Id=01t19000004ceAgAAI}, Product2:{Id=01t19000004ceAhAAI}, Product2:{Id=01t19000004ceAiAAI}, Product2:{Id=01t19000004ceAjAAI}, Product2:{Id=01t19000004ceAkAAI}, Product2:{Id=01t19000004ceAlAAI}, Product2:{Id=01t19000004ceAmAAI}, Product2:{Id=01t19000004ceAnAAI}, Product2:{Id=01t19000004ceAoAAI}, Product2:{Id=01t19000004ceApAAI}, ...)
[511] > List<Product2> products = new List<Product2>();
[511] > products.add(new Product2(Name='Nick'));
[511] > print(products);
(Product2:{Name=Nick})
[511] >
koa delete
Delete a local scratch org.
$ koa delete -u scratch-org-name Deleting scratch-org-name... Enqueue scratch org with name: scratch-org-name for deletion? Are you sure (y/n)?: y Successfully marked scratch org scratch-org-name for deletion
koa display
Display information about a scratch org.
$ koa display -u scratch-org-name Displaying details for scratch-org-name... === Org Description KEY VALUE ─────────────── ──────────────────────────────────────────────────────────────────────────────────────────────────────────────── Access Token 00D190000009VFq!AR8AQEQJruhwDR65rOP.yt4p_Zw.Rwm6x7LWUsWMExNhlKw0MlcOb8h7wcodhNxf5xjoKXOrToYx7G7AfNYNd27L2VvvOrae Alias devNoErrorOnNewQuote Client Id SalesforceDevelopmentExperience Created By siddhanth.maheshwari@steelbrick.com Created Date 2019-01-21T21:21:42.000+0000 Dev Hub Id siddhanth.maheshwari@steelbrick.com Edition Developer Expiration Date 2019-02-20 Id 00D190000009VFqEAM Instance Url https://platform-innovation-1185-dev-ed.cs24.my.salesforce.com/ Org Name CPQ SFDX Password 3o-Ar]F0Vr Status Active Username test-f9tschut68cl@example.com
koa log
Tail live logs for a scratch org. These logs only show SOQL queries and user debug statements, filtering out a lot of junk logs provided by sfdx.
$ koa log -u scratch-org-name --- (210) Logging session started --- 21:50:53.0 (483449) | CODE_UNIT_STARTED | SBQQ.ServiceRouter.load(String) 21:50:53.0 (178776187) | CODE_UNIT_FINISHED | SBQQ.ServiceRouter.load(String) 21:50:53.0 (565893) | CODE_UNIT_STARTED | SBQQ.ServiceRouter.load(String) 21:50:54.428 (1437224689) | USER_DEBUG | {"queryInfo":{}} 21:50:54.428 (1439665104) | CODE_UNIT_FINISHED | SBQQ.ServiceRouter.load(String) 21:50:53.0 (225805) | CODE_UNIT_STARTED | SBQQ.ServiceRouter.load(String) ...
koa open
Opens a given scratch org and logs in.
$ koa open -u scratch-org-name $ koa open -d
koa org
Create a scratch org off the current branch, push default CPQ configurations and data.
$ koa org -n scratch-org-name
koa orgs
To see all local scratch orgs, run:
$ koa orgs
koa package
Generates a SFDX package and package version.
$ koa package
koa push
Pushes local changes to given scratch org.
$ koa push -u scratch-org-name
koa revive
Automatically create a scratch org from any version of CPQ with a version number or git SHA. This can be useful if you need to reproduce an issue in a v26 scratch org for instance.
To revive an old CPQ version, navigate outside your CPQ repo into another folder you'd like to clone an older version of CPQ. Then run:
$ koa revive
23.0.20 25.0.9 27.0 208.1 212.0 216.10.1
23.0.23 25.0.10 27.0.1 208.1.1 212.1 216.10.2
23.0.24 25.0.11 27.0.3 208.2 212.2 216.10.3
23.0.25 25.0.12 27.0.4 208.3 212.3 216.10.4
23.0.26 25.0.13 27.0.5 208.4 212.4 218.1.0
23.1 25.0.14 27.0.7 208.5 212.5 218.2.0
23.1.1 25.0.15 27.0.7.1 208.6 212.6 218.3.0
23.2.1 25.0.16 27.0.7.2 208.6.1 212.8 218.5.0
23.2.3 25.0.19 27.0.14 208.6.2 212.9 218.6.0
23.4.1 25.0.20 27.0.15 208.7 212.10 218.7.0
23.5 25.1 27.0.16 208.8 212.11 218.8.0
Which version would you like to revive from? 27.0
Checking out git SHA (877deea76a891d64f782cc7f18fea788af138b84)...
...
To revive from a specific git SHA commit, run:
$ koa revive -s sha-number
koa run
Run APEX scripts on a scratch org.
$ koa run script.apex -u scratch-org-name Hello, world
koa service-cloud
Create a CPQ Service Cloud scratch org.
koa service-cloud -u scratch-org-name
koa set-default
Sets the scratch-org-name as the default scratch org
koa set-default -u scratch-org-name
koa sfm
Automatically clicks the SFM tile in Aloha for you.
koa sfm
koa test
Run APEX tests. Provide either the test class name or additionally specify the exact test methods to run as well in a comma-separated list.
koa test -u scratch-org-name TestClassName,AnotherTestClassName.TestMethodName
koa trustmaster
Spins up multiple scratch orgs at the same time in various CPQ versions, allowing you to QA bugs in different CPQ versions as a Trustmaster.
$ koa trustmaster What is your dev hub email address? youremail@steelbrick.com Starting trustmaster... .... All scratch orgs created.
koa user
Creates a new user for a given scratch org.
koa user -n user-name -u scratch-org-name
koa userinfo
Displays user information for a given user.
koa userinfo -n user-name
koa users
Displays all the users for a given scratch org.
koa users -u scratch-org-name
koa web-test
Automatically setup and run the Selenium web test environment with the following command:
koa web-test
Specific tests can be run with:
koa web-test test-name
Updates
TODO: Koa will automatically update itself every few weeks. If you'd like to upgrade at any point in time you just need to run:
koa upgrade
Magic!
Contributions
I'm far from being a CPQ expert and suspect there are many ways to improve – if you have ideas on how to make the tool easier to maintain (and faster), don't hesitate to fork and send pull requests!