sf-raven
v1.2.3
Published
A custom sf plugin built by @tomcarman
Downloads
771
Maintainers
Readme
Overview
Features
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, streamed to your terminal.
sf raven deploy
- sf raven deploy cancel
- Query an org for pending or in progress Salesforce deployments, and cancel them.
sf raven query
- sf raven query ids
- Run a SOQL query against a large list of Salesforce IDs.
sf raven pull
- sf raven pull
- Update Salesforce metadata into the local project via a fuzzy finder.
- sf raven pull remote
- Retrieve Salesforce metadata that exists in the org but not locally, via a fuzzy finder.
Install
Dependencies
- fzf is required for the sf raven pull commands, and should be available on your path. (IMO they are probably the most useful commands in this plugin, so its worth setting up fzf if you don't have it.)
Quick Install
Assuming you already have the sf cli installed, the plugin can be installed by running:
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
Updating the plugin
The plugin can be updated to the latest version using
sf plugins update
Install from source
- Install the SDFX CLI
- Clone the repository:
git clone [email protected]:tomcarman/sf-raven.git - Install npm modules:
npm install - Link the plugin:
sfdx plugins:link .
Compatibility
- macOS
- Plugin has been built on macOS and will always run on macOS
Command Reference
sf raven object display fields
Show field information for a given sObject.
USAGE
$ sf raven object display fields -o <value> -s <value> [--json] [-c <value>]
FLAGS
-c, --csv=<value> Path to write field information as CSV. When supplied, table output is suppressed.
-o, --target-org=<value> (required) Login username or alias for the target org.
-s, --sobject=<value> (required) The API name of the sObject that you want to view fields for. Use a comma-delimited list to query multiple objects.
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
$ sf raven object display fields --target-org dev --sobject Account,Contact
$ sf raven object display fields --target-org dev --sobject Account --csv account-fields.csv
OUTPUT
Name Developer Name Type
────────────────── ─────────────── ─────────────────
Account Number AccountNumber Text(40)
Account Source AccountSource Picklist
Annual Revenue AnnualRevenue Currency(18, 0)
...sf raven object display recordtypes
Show RecordType information for a given sObject.
USAGE
$ sf raven object display recordtypes -o <value> -s <value> [--json] [-c <value>]
FLAGS
-c, --csv=<value> Path to write Record Type information as CSV. When supplied, table output is suppressed.
-o, --target-org=<value> (required) Login username or alias for the target org.
-s, --sobject=<value> (required) The API name of the sObject that you want to view Record Types for. Use a comma-delimited list to query multiple objects.
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
$ sf raven object display recordtypes --target-org dev --sobject Account,Opportunity
$ sf raven object display recordtypes --target-org dev --sobject Account --csv account-record-types.csv
OUTPUT
Name Developer Name Id
─────────────────── ─────────────────────── ──────────────────
Business Account Business_Account 0124J000000XXXXABC
Person Account PersonAccount 0124J000000YYYYDEF
...sf raven pull
Update Salesforce metadata into the local project via a fuzzy finder.
USAGE
$ sf raven pull [--json] [-o <value>] [-a]
FLAGS
-a, --all Retrieve all local package directories instead of selecting a path with fzf.
-o, --target-org=<value> Login username or alias for the target org. Uses the default org when omitted.
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Refresh local Salesforce metadata from an authenticated org. Without --all, local metadata paths are loaded into fzf so you can choose one or more files or directories to retrieve. Press Tab to select multiple paths, then Enter to retrieve them together. With --all, each package directory from sfdx-project.json is retrieved.
EXAMPLES
$ sf raven pull
$ sf raven pull --target-org dev
$ sf raven pull --all
$ sf raven pull --target-org dev --allsf raven pull remote
Retrieve Salesforce metadata that exists in the org but not locally, via a fuzzy finder.
USAGE
$ sf raven pull remote [--json] [-o <value>]
FLAGS
-o, --target-org=<value> Login username or alias for the target org. Uses the default org when omitted.
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
List supported metadata components that exist in the target org but are not present in the local project. Org-only components are prefixed with a cloud marker in fzf. Press Tab to select multiple components, then Enter to retrieve them.
EXAMPLES
$ sf raven pull remote
$ sf raven pull remote --target-org devsf raven deploy cancel
Cancel a pending or in-progress Salesforce deploy.
USAGE
$ sf raven deploy cancel [--json] [-o <value>]
FLAGS
-o, --target-org=<value> Login username or alias for the target org. Uses the default org when omitted.
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Query the target org for pending or in-progress deploy requests, select one from an interactive list, confirm the cancellation, and submit an asynchronous deploy cancel request.
EXAMPLES
$ sf raven deploy cancel
$ sf raven deploy cancel --target-org devsf raven query ids
Run a SOQL query against a large list of Salesforce IDs.
USAGE
$ sf raven query ids -f <value> -q <value> [--json] [-o <value>] [-b <value>] [-c <value>] [-l <value>]
FLAGS
-b, --batch-size=<value> Number of IDs to include in each query batch. By default, batches are sized to fit Salesforce URI limits.
-c, --csv=<value> Path to write query results as CSV. When supplied, table output is suppressed.
-f, --file=<value> (required) Path to a file containing one Salesforce ID per row.
-l, --limit=<value> Process only the first N unique valid IDs from the file.
-o, --target-org=<value> Login username or alias for the target org. Uses the default org when omitted.
-q, --query=<value> (required) SOQL query to run. Must include the {ids} placeholder where the ID list should be inserted.
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Read Salesforce IDs from a file, deduplicate and validate them, split them into safe query batches, and run a SOQL query with the IDs inserted at the {ids} placeholder.
EXAMPLES
$ sf raven query ids --file account-ids.txt --query "SELECT Id, Name FROM Account WHERE Id IN {ids}"
$ sf raven query ids --file account-ids.txt --query "SELECT Id, Name FROM Opportunity WHERE AccountId IN {ids}"
$ sf raven query ids --file account-ids.txt --query "SELECT Id, Name FROM Account WHERE Id IN {ids}" --limit 25
$ sf raven query ids --file account-ids.txt --query "SELECT Id, Name FROM Account WHERE Id IN {ids}" --csv results.csvsf raven audit display
Show recent entries in the Setup Audit Trail.
USAGE
$ sf raven audit display -o <value> [--json] [-u <value>] [-l <value>]
FLAGS
-l, --limit=<value> [default: 20] The number of audit trail entries to return. Maximum is 2000.
-o, --target-org=<value> (required) Login username or alias for the target org.
-u, --username=<value> Username to filter the audit trail by.
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 [email protected]
$ sf raven audit display --target-org dev --limit 50 --username [email protected]
OUTPUT
Date Username Type Action Delegate User
─────────────────── ───────────── ──────────── ─────────────────────────────────────────────────────────── ────────────────────
2023-09-29 17:23:47 [email protected] Apex Trigger Changed Account Created Trigger code: AccountTrigger null
2023-09-29 17:23:43 [email protected] Apex Trigger Created Account Created Trigger code: AccountCreatedTrigger null
...sf raven event subscribe
Subscribe to Platform Events, streamed to your terminal.
USAGE
$ sf raven event subscribe -o <value> -e <value> [--json] [-r <value>] [-t <value>]
FLAGS
-e, --event=<value> (required) The name of the Platform Event that you want to subscribe with '/event/' prefix eg. /event/My_Event__e.
-o, --target-org=<value> (required) Login username or alias for the target org.
-r, --replayid=<value> The replay id to replay events from eg. 21980378.
-t, --timeout=<value> [default: 3] How long to subscribe for before timing out in minutes eg. 10. Default is 3 minutes.
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
}
}