Getting Started

Creating the events-plugin project

In order to create a new plugin we will use the @salesforce/plugin-dev plugin for the sf CLI.

Let's install the plugin by running:

sf plugins install @salesforce/plugin-dev

Then, let's generate a project by running:

sf dev generate plugin

This will ask you some questions about the plugin you are creating

Salesforce Plugin Generator

Let's take a look at the project structure with Visual Studio Code

All our commands are going to live under the src/commands folder, in this case, it auto-generated an example under the hello folder, which in th is case it will be a topic, and the world command. Let's execute it in development mode by running:

./bin/dev hello world

Or you can also get the general help for your plugin by just running:

./bin/dev

As you can see, the Salesforce CLI framework, powered by oclif, takes care of the documentation of a command for you.

Since our commands will require an authenticated org to work, let's login by using:

sf login org -a <alias> -d

Now it is time to build our commands!

Last updated