A custom sf plugin built by @tomcarman
npm install sf-raven  
A plugin for the Salesforce CLI built by Tom Carman.
sf-raven now replaces sfdx-raven.
I originally built sfdx-raven in 2020, but the Salesforce CLI landscape has changed a lot since then. Rather than attempting to migrate the original plugin from sfdx to sf, it felt cleaner to start a new project and leverage the new architecture and scaffolding tools that come with the new sf cli.
- Built on sf not sfdx.
- Uses the latest version of oclif.
- Commands now follow the sf command structure guidelines - . For example:
- info:fields becomes object display fields
- utils:event:listen becomes event subscribe
- Code now meets ESlint rules for TypeScript, including the Salesforce CLI Plugin custom rules.
- The Salesforce tooling / documentation for building custom plugins has matured a lot over the past couple years, which will make it easier to update the plugin going forward.
More commands will be ported/added over time - see Todo.
Full details, usage, examples etc are further down, or can be accessed via --help on the commands.
#### sf raven object display
- sf raven object display fields
- Show field information for a given sObject.
- sf raven object display recordtypes
- Show RecordType information for a given sObject.
#### sf raven audit display
- sf raven audit display
- Show recent entries in the Setup Audit Trail.
#### sf raven event
- sf raven event subscribe
- Subscribe to Platform Events.
Assuming you already have the SDFX CLI installed, just run:
sf plugins install sf-raven
Note: You'll be prompted that this is not officially code-signed by Salesforce - like any custom plugin. You can just accept this when prompted, or alternatively you can whitelist it
The plugin can be updated to the latest version using
sf plugins update
1. Install the SDFX CLI
2. Clone the repository: git clone git@github.com:tomcarman/sf-raven.git
3. Install npm modules: npm install
4. Link the plugin: sfdx plugins:link .
- macOS
- Plugin has been built on macOS and will always run on macOS
- Migrate remaining commands from sfdx-raven
- sfdx raven:utils:deploy:branch2org
- sfdx raven:utils:diff
- sfdx raven:utils:dashboarduser:update - tbc
- Get the sObject Type for a given Id
- Get the picklist values for a given picklist
- Clone a record
Show field information for a given sObject.
``
USAGE
$ sf raven object display fields -o
FLAGS
-o, --target-org=
-s, --sobject=
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Show field information for a given sObject.
FieldDefinition metadata is queried for the given sObject. The field Labels, API names, and Type are displayed.
EXAMPLES
$ sf raven object display fields --target-org dev --sobject Account
$ sf raven object display fields --target-org dev --sobject My_Custom_Object__c
OUTPUT
Name Developer Name Type
────────────────── ─────────────── ─────────────────
Account Number AccountNumber Text(40)
Account Source AccountSource Picklist
Annual Revenue AnnualRevenue Currency(18, 0)
...
`
Show RecordType information for a given sObject.
`
USAGE
$ sf raven object display recordtypes -o
FLAGS
-o, --target-org=
-s, --sobject=
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Show RecordType information for a given sObject.
RecordType metadata is queried for the given sObject. The RecordType Name, DeveloperName, and Id are displayed.
EXAMPLES
$ sf raven object display recordtypes --target-org dev --sobject Account
$ sf raven object display recordtypes --target-org dev --sobject My_Custom_Object__c
OUTPUT
Name Developer Name Id
─────────────────── ─────────────────────── ──────────────────
Business Account Business_Account 0124J000000XXXXABC
Person Account PersonAccount 0124J000000YYYYDEF
...
`
Show recent entries in the Setup Audit Trail.
`
USAGE
$ sf raven audit display -o
FLAGS
-l, --limit=
-o, --target-org=
-u, --username=
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Show recent entries in the Setup Audit Trail.
Returns the 20 most recent Setup Audit Trail entries, but this can be increased up to 2000 using the optional --limit flag. The results can be filtered by a particular user using the --username flag.
EXAMPLES
$ sf raven audit display --target-org dev
$ sf raven audit display --target-org dev --limit 200
$ sf raven audit display --target-org dev --username username@salesforce.com.dev
$ sf raven audit display --target-org dev --limit 50 --username username@salesforce.com.dev
OUTPUT
Date Username Type Action Delegate User
─────────────────── ───────────── ──────────── ─────────────────────────────────────────────────────────── ────────────────────
2023-09-29 17:23:47 user@dev.com Apex Trigger Changed Account Created Trigger code: AccountTrigger null
2023-09-29 17:23:43 user@dev.com Apex Trigger Created Account Created Trigger code: AccountCreatedTrigger null
...
`
Subscribe to Platform Events.
`
USAGE
$ sf raven event subscribe -o
FLAGS
-e, --event=
-o, --target-org=
-r, --replayid=
-t, --timeout=
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Subscribe to Platform Events.
Platform Events are printed to the terminal. An optional flag can be used to relay events from a given relayid. Defaut timeout is 3 minutes, but can be extended to 30 minutes.
EXAMPLES
$ sf raven event subscribe --target-org dev --event /event/My_Event__e
$ sf raven event subscribe --target-org dev --event /event/My_Event__e --replayid 21980378
$ sf raven event subscribe --target-org dev --event /event/My_Event__e --timeout 10
$ sf raven event subscribe --target-org dev --event /event/My_Event__e --replayid 21980378 --timeout 10
OUTPUT
❯ 🔌 Connecting to org... done
❯ 📡 Listening for events...
{
"schema": "XdDXhymeO5NOxuhzFpgDJA",
"payload": {
"Some_Event_Field__c": "Hello World",
"CreatedDate": "2021-03-15T19:16:54.929Z",
},
"event": {
"replayId": 21980379
}
}
`